Control program for a four-legged 12 axis robot.

Dependencies:   CircularBuffer Servo Terminal mbed Radio

Committer:
pclary
Date:
Wed May 22 23:48:24 2013 +0000
Revision:
15:ab358f19cf76
Parent:
11:9ee0214bd410
Preliminary orientation support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pclary 3:6fa07ceb897f 1 #ifndef ROBOTLEG_H
pclary 3:6fa07ceb897f 2 #define ROBOTLEG_H
pclary 3:6fa07ceb897f 3
pclary 3:6fa07ceb897f 4 #include "mbed.h"
pclary 3:6fa07ceb897f 5 #include "Servo.h"
pclary 3:6fa07ceb897f 6 #include "Matrix.h"
pclary 3:6fa07ceb897f 7
pclary 3:6fa07ceb897f 8
pclary 3:6fa07ceb897f 9
pclary 3:6fa07ceb897f 10 class RobotLeg
pclary 3:6fa07ceb897f 11 {
pclary 3:6fa07ceb897f 12 public:
pclary 8:db453051f3f4 13 RobotLeg(PinName thetaPin, PinName phiPin, PinName psiPin, bool start = true);
pclary 3:6fa07ceb897f 14 void setDimensions(float a, float b, float c, float d);
pclary 3:6fa07ceb897f 15 void setAngleOffsets(float oth, float oph, float ops);
pclary 5:475f67175510 16 void setStepCircle(float xc, float yc, float zc, float rc);
pclary 3:6fa07ceb897f 17 vector3 getPosition();
pclary 3:6fa07ceb897f 18 bool move(vector3 dest);
pclary 3:6fa07ceb897f 19 void step(vector3 dest);
pclary 9:a6d1502f0f20 20 vector3 reset(float f);
pclary 15:ab358f19cf76 21 bool update(const matrix4& deltaTransform, matrix4* orientation_ = NULL);
pclary 11:9ee0214bd410 22 void apply();
pclary 11:9ee0214bd410 23 bool getStepping();
pclary 3:6fa07ceb897f 24
pclary 3:6fa07ceb897f 25 Servo theta, phi, psi;
pclary 6:0163f2737cc6 26 vector3 nDeltaPosition;
pclary 3:6fa07ceb897f 27
pclary 3:6fa07ceb897f 28 protected:
pclary 5:475f67175510 29 float thetaAngle, phiAngle, psiAngle;
pclary 5:475f67175510 30 float circleRadius;
pclary 3:6fa07ceb897f 31 float a, b, c, d;
pclary 3:6fa07ceb897f 32 float oth, oph, ops;
pclary 6:0163f2737cc6 33 float stepDelta, stepTime, stepHeight;
pclary 5:475f67175510 34 vector3 circleCenter;
pclary 15:ab358f19cf76 35 //vector3 position;
pclary 3:6fa07ceb897f 36 vector3 stepA;
pclary 3:6fa07ceb897f 37 vector3 stepB;
pclary 11:9ee0214bd410 38 vector3 newPosition;
pclary 3:6fa07ceb897f 39
pclary 15:ab358f19cf76 40 matrix4* orientation;
pclary 15:ab358f19cf76 41
pclary 5:475f67175510 42 enum state_t
pclary 3:6fa07ceb897f 43 {
pclary 3:6fa07ceb897f 44 neutral,
pclary 3:6fa07ceb897f 45 stepping
pclary 3:6fa07ceb897f 46 };
pclary 3:6fa07ceb897f 47
pclary 5:475f67175510 48 state_t state;
pclary 3:6fa07ceb897f 49
pclary 3:6fa07ceb897f 50 Timer stepTimer;
pclary 3:6fa07ceb897f 51
pclary 3:6fa07ceb897f 52 };
pclary 3:6fa07ceb897f 53
pclary 3:6fa07ceb897f 54 #endif // ROBOTLEG_H