Example use of I2CTransaction class. In this example, the master mbed is talking to 3 legs of the SIPPC3B robot.
Diff: LegInterface.h
- Revision:
- 2:17c7a02f8401
- Parent:
- 1:d3abc0577ebc
- Child:
- 3:8e7471af3453
--- a/LegInterface.h Thu May 22 21:17:58 2014 +0000 +++ b/LegInterface.h Fri May 23 19:27:12 2014 +0000 @@ -11,14 +11,28 @@ // An array of I2C addresses indexable by enum Leg static const int LegAddress[]; + + // Encoder to wheel + static const float TICKS_PER_METER = 52633.97; + + // Angle between front legs + static const float FRONT_LEG_ANGLE = 130; // Degrees + + // Distance from center of robot to wheel + static const float ROBOT_RADIUS = 0.4702; // m + + // Number of A2D ticks per meter. TODO: is 4096 right? + static const float LIFT_TICKS_PER_METER = 4096 / 0.1; LegInterface(Serial *pc = NULL); bool sendEstop(bool estop); bool queryStateInitiate(); - bool queryStateCompleted(int timeout = 1000); + bool queryStateCompleted(); + bool queryStateWaitForCompletion(int timeout = 1000); bool queryStateCopy(LegState_t legState[NUM_LEGS]); + bool queryStateCopy(float liftPosition[NUM_LEGS], float liftVelocity[NUM_LEGS], float wheelPosition[NUM_LEGS], float wheelVelocity[NUM_LEGS]); void displayLegState(LegState_t *legState); bool queryLegParams(Leg leg, LegControlParams_t *liftParams, LegControlParams_t *wheelParams); void displayParams(LegControlParams_t *params);