1

Dependencies:   CircularBuffer Radio Servo Terminal mbed

Fork of WalkingRobot by Patrick Clary

Committer:
alex03
Date:
Tue Apr 09 01:40:27 2013 +0000
Revision:
11:975d24305af7
Parent:
9:a6d1502f0f20
g

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 5:475f67175510 21 bool update(const matrix4& deltaTransform);
pclary 3:6fa07ceb897f 22
pclary 3:6fa07ceb897f 23 Servo theta, phi, psi;
pclary 6:0163f2737cc6 24 vector3 nDeltaPosition;
pclary 3:6fa07ceb897f 25
pclary 3:6fa07ceb897f 26 protected:
pclary 5:475f67175510 27 float thetaAngle, phiAngle, psiAngle;
pclary 5:475f67175510 28 float circleRadius;
pclary 3:6fa07ceb897f 29 float a, b, c, d;
pclary 3:6fa07ceb897f 30 float oth, oph, ops;
pclary 6:0163f2737cc6 31 float stepDelta, stepTime, stepHeight;
pclary 5:475f67175510 32 vector3 circleCenter;
pclary 3:6fa07ceb897f 33 vector3 position;
pclary 3:6fa07ceb897f 34 vector3 stepA;
pclary 3:6fa07ceb897f 35 vector3 stepB;
pclary 3:6fa07ceb897f 36
pclary 5:475f67175510 37 enum state_t
pclary 3:6fa07ceb897f 38 {
pclary 3:6fa07ceb897f 39 neutral,
pclary 3:6fa07ceb897f 40 stepping
pclary 3:6fa07ceb897f 41 };
pclary 3:6fa07ceb897f 42
pclary 5:475f67175510 43 state_t state;
pclary 3:6fa07ceb897f 44
pclary 3:6fa07ceb897f 45 Timer stepTimer;
pclary 3:6fa07ceb897f 46
pclary 3:6fa07ceb897f 47 };
pclary 3:6fa07ceb897f 48
pclary 3:6fa07ceb897f 49 #endif // ROBOTLEG_H