Add CustomTimer and separate left/right leg handling

Imported from the unarchived 'hexapod' sketch folder. The real date of this
version is unknown; file dates were lost in a 2016-11-14 copy.
This commit is contained in:
mangavalk committed 2016-11-14 13:07:00 +01:00
1 parent 0447cb8c7a
commit 972ba2cb73
3 files changed
+116 -48

No files matched your search

@@ -188,40 +188,84 @@ class Foot
Z = -1 * (Z - TranslateZ);
}
double a = (90 - degrees((float)(O1())));
double b = (180 - degrees((float)(T1())));
double c = degrees((float)(T3()));
if (leftLegorRight)
{ // right
double a = (90 - degrees((float)(O1())));
double b = (180 - degrees((float)(T1())));
double c = degrees((float)(T3()));
if ((a >= 15) & (a <= 165)
& (b >= 15) & (b <= 165)
& (c >= 15) & (c <= 165))
{
error = false;
if ((a >= 15) & (a <= 165)
& (b >= 15) & (b <= 165)
& (c >= 15) & (c <= 165))
{
error = false;
O1 = a;
O2 = b;
O3 = c;
O1 = a;
O2 = b;
O3 = c;
double d = sin((float)(b*(PI/180)));
if ( d != 0 )
X2 = d * l1;
else
X2 = 0;
double d = sin((float)(b*(PI/180)));
if ( d != 0 )
X2 = d * l1;
else
X2 = 0;
d = cos((float)(b*(PI/180)));
if ( d != 0 )
Y2 = d * l1;
else
Y2 = 0;
d = cos((float)(b*(PI/180)));
if ( d != 0 )
Y2 = d * l1;
else
Y2 = 0;
d = sin((float)((a-90)*(PI/180)));
if ( d != 0 )
Z2 = d * abs((float)(X2));
else
Z2 = 0;
d = sin((float)((a-90)*(PI/180)));
if ( d != 0 )
Z2 = d * abs((float)(X2));
else
Z2 = 0;
} else
{
error = true;
}
} else
{
error = true;
double a = (90 - degrees((float)(O1())));
double b = degrees((float)(T1()));
double c = 180 - degrees((float)(T3()));
if ((a >= 15) & (a <= 165)
& (b >= 15) & (b <= 165)
& (c >= 15) & (c <= 165))
{
error = false;
O1 = a;
O2 = b;
O3 = c;
a = (90 - degrees((float)(O1())));
b = (180 - degrees((float)(T1())));
c = degrees((float)(T3()));
double d = sin((float)(b*(PI/180)));
if ( d != 0 )
X2 = d * l1;
else
X2 = 0;
d = cos((float)(b*(PI/180)));
if ( d != 0 )
Y2 = d * l1;
else
Y2 = 0;
d = sin((float)((a-90)*(PI/180)));
if ( d != 0 )
Z2 = d * abs((float)(X2));
else
Z2 = 0;
} else
{
error = true;
}
}
}
}