File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
BlackBox/BlackBox/Samples Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ public class RoboticArm : BlackBox
8
8
{
9
9
//Fields
10
10
const double LENGTH1 = 300 ; //mm
11
- double theta1 = 225 ; //degrees (180 to 315 )
11
+ double theta1 = 135 ; //degrees (45 to 180 )
12
12
double length2 = 150 ; //mm (100 to 300)
13
- double theta3 = 225 ; //degrees (90 to 180 )
13
+ double theta3 = 135 ; //degrees (90 to 270 )
14
14
const double LENGTH3 = 50 ; //mm
15
15
double x = 0 ;
16
16
double y = 0 ;
@@ -47,12 +47,12 @@ public override void Run()
47
47
48
48
//Update theta1
49
49
theta1 = theta1 + ( 0.1 * voltageMotor1 ) ;
50
- if ( theta1 <= 180 )
50
+ if ( theta1 <= 45 )
51
+ theta1 = 45 ;
52
+ else if ( theta1 >= 180 )
51
53
theta1 = 180 ;
52
- else if ( theta1 >= 315 )
53
- theta1 = 315 ;
54
54
55
- //Update theta2
55
+ //Update length 2
56
56
length2 = length2 + ( 0.1 * voltageMotor2 ) ;
57
57
if ( length2 <= 100 )
58
58
length2 = 100 ;
@@ -61,10 +61,10 @@ public override void Run()
61
61
62
62
//Update theta3
63
63
theta3 = theta3 + ( 0.1 * voltageMotor1 ) ;
64
- if ( theta3 <= 180 )
65
- theta3 = 180 ;
66
- else if ( theta3 >= 315 )
67
- theta3 = 315 ;
64
+ if ( theta3 <= 90 )
65
+ theta3 = 90 ;
66
+ else if ( theta3 >= 270 )
67
+ theta3 = 270 ;
68
68
69
69
//Update x and y coordinates of end factor
70
70
double theta1abs = 180 + theta1 ;
You can’t perform that action at this time.
0 commit comments