Skip to content

Commit 8b49d6b

Browse files
committed
Corrections to robot arm limits
1 parent 505b5c4 commit 8b49d6b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

BlackBox/BlackBox/Samples/RoboticArm.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public class RoboticArm : BlackBox
88
{
99
//Fields
1010
const double LENGTH1 = 300; //mm
11-
double theta1 = 225; //degrees (180 to 315)
11+
double theta1 = 135; //degrees (45 to 180)
1212
double length2 = 150; //mm (100 to 300)
13-
double theta3 = 225; //degrees (90 to 180)
13+
double theta3 = 135; //degrees (90 to 270)
1414
const double LENGTH3 = 50; //mm
1515
double x = 0;
1616
double y = 0;
@@ -47,12 +47,12 @@ public override void Run()
4747

4848
//Update theta1
4949
theta1 = theta1 + (0.1 * voltageMotor1);
50-
if (theta1 <= 180)
50+
if (theta1 <= 45)
51+
theta1 = 45;
52+
else if (theta1 >= 180)
5153
theta1 = 180;
52-
else if (theta1 >= 315)
53-
theta1 = 315;
5454

55-
//Update theta2
55+
//Update length 2
5656
length2 = length2 + (0.1 * voltageMotor2);
5757
if (length2 <= 100)
5858
length2 = 100;
@@ -61,10 +61,10 @@ public override void Run()
6161

6262
//Update theta3
6363
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;
6868

6969
//Update x and y coordinates of end factor
7070
double theta1abs = 180 + theta1;

0 commit comments

Comments
 (0)