FireFly 2011: tuned leg positions, walk sequence and IK

From 'hexapod V2 29-12-11.rar' (main file was hexapod.pde).
This commit is contained in:
mangavalk committed 2011-12-02 22:03:05 +01:00
1 parent fe472bfce9
commit 8e66e26bb9
3 files changed
+19 -35

No files matched your search

@@ -9,7 +9,10 @@ void InverseKinemetics::RL3 (int i)
float InverseKinemetics::ZX (int i) float InverseKinemetics::ZX (int i)
{ {
RL3(i); RL3(i);
float temp = degrees(acos((float)COR_2_IK[2+(i*3)] / l3)); if (COR_2_IK[2+(i*3)] != 0)
float temp = degrees(acos((float)COR_2_IK[2+(i*3)] / l3));
else
float temp = 90; // Math Error Protection.
return temp; return temp;
} }
@@ -24,10 +27,10 @@ float InverseKinemetics::TT (int i)
R[i] = 3; R[i] = 3;
float t1 = degrees(acos((pow(s, 2) + pow(COR_2_IK[1+(i*3)], 2) - pow(l3, 2)) float t1 = degrees(acos((pow(s, 2) + pow(COR_2_IK[1+(i*3)], 2) - pow(l3, 2))
/ (2 * s * COR_2_IK[1+(i*3)]))); / (2 * s * COR_2_IK[1+(i*3)])));
float t2 = degrees(acos((pow(s, 2) + pow(l1, 2) - pow(l2, 2)) float t2 = degrees(acos((pow(s, 2) + pow(l1, 2) - pow(l2, 2))
/ (2 * s * l1))); / (2 * s * l1)));
float temp = (int)t1 + t2; float temp = (int)t1 + t2;
//Serial.print("DEBUG: "); Serial.print(t1); Serial.print(", "); Serial.print(t2); Serial.print(", "); Serial.println(temp); //Serial.print("DEBUG: "); Serial.print(t1); Serial.print(", "); Serial.print(t2); Serial.print(", "); Serial.println(temp);
@@ -151,3 +154,4 @@ int InverseKinemetics::CheckForErrorAng()
@@ -101,8 +101,8 @@ void loop()
COR_2_IK[2+(2*3)] = 10;/// COR_2_IK[2+(2*3)] = 10;///
COR_2_IK[2+(3*3)] = -10;// COR_2_IK[2+(3*3)] = -10;//
COR_2_IK[2+(5*3)] = 10;/// COR_2_IK[2+(5*3)] = 10;///
COR_2_IK[0+(1*3)] = 15;// z side body COR_2_IK[0+(1*3)] = 10;// z side body
COR_2_IK[0+(4*3)] = 15; COR_2_IK[0+(4*3)] = 10;
} }
else else
{ {
@@ -2,37 +2,17 @@
// Hexapod seqencer. // Hexapod seqencer.
int TriPoD_Size = 8; int TriPoD_Size = 8;
// zij, laag, achter
// 15, 15, -15, 15, 15, 0, 15, 15, 15, 15, 15, -15, 15, 15, 0, 15, 15, 15;
int TriPoD[8][18] = { int TriPoD[8][18] = {
{// -15 is voor {10,10, 0,10,15, 0,10,10, 0,10,15, 0,10,10, 0,10,15, 0},
15, 2, 0, 15, 15, 0, 15, 2, 0, 15, 15, 0,15, 2, 0, 15, 15, 0 }//miden*hoog, miden*laag {10,10,-2,10,15, 2,10,10,-2,10,15, 3,10,10,-2,10,15, 2},
, {10,15,-2,10,15, 2,10,15,-2,10,15, 3,10,15,-2,10,15, 2},
{ {10,15,-2,10,10, 2,10,15,-2,10,10, 3,10,15,-2,10,10, 2},
15, 2, -2, 15, 15, 2, 15, 2, -2, 15, 15, 2,15, 2, -2, 15, 15, 2 }// voor*hoog, achter*laag {10,15, 0,10,10, 0,10,15, 0,10,10, 0,10,15, 0,10,10, 0},
, {10,15, 2,10,10,-2,10,15, 2,10,10,-2,10,15, 2,10,10,-2},
{ {10,15, 2,10,15,-2,10,15, 2,10,15,-2,10,15, 2,10,15,-2},
15, 15, -2, 15, 15, 2, 15, 15, -2, 15, 15, 2,15, 15, -2, 15, 15, 2 }// laag, niks {10,10, 2,10,15,-2,10,10, 2,10,15,-2,10,10, 2,10,15,-2}
, };
{
15, 15, -2, 15, 2, 2, 15, 15, -2, 15, 2, 2,15, 15, -2, 15, 2, 2 }// niks, hoog
,
{
15, 15, 0, 15, 2, 0, 15, 15, 0, 15, 2, 0,15, 15, 0, 15, 2, 0 }//midden*laag, miden*hoog
,
{
15, 15, 2, 15, 2, -2, 15, 15, 2, 15, 2, -2,15, 15, 2, 15, 2, -2 }//voor-laag, achter/hoog
,
{
15, 15, 2, 15, 15, -2, 15, 15, 2, 15, 15, -2,15, 15, 2, 15, 15, -2 }// niks, laag
,
{
15, 2, 2, 15, 15, -2, 15, 2, 2, 15, 15, -2,15, 2, 2, 15, 15, -2 }// hoog, niks
};