1

Dependencies:   CircularBuffer Radio Servo Terminal mbed

Fork of WalkingRobot by Patrick Clary

RobotLeg.h

Committer:
pclary
Date:
2013-01-13
Revision:
5:475f67175510
Parent:
3:6fa07ceb897f
Child:
6:0163f2737cc6

File content as of revision 5:475f67175510:

#ifndef ROBOTLEG_H
#define ROBOTLEG_H

#include "mbed.h"
#include "Servo.h"
#include "Matrix.h"



class RobotLeg
{
public:
    RobotLeg(PinName thetaPin, PinName phiPin, PinName psiPin);
    void setDimensions(float a, float b, float c, float d);
    void setAngleOffsets(float oth, float oph, float ops);
    void setStepCircle(float xc, float yc, float zc, float rc);
    vector3 getPosition();
    bool move(vector3 dest);
    void step(vector3 dest);
    void reset(float f);
    bool update(const matrix4& deltaTransform);

    Servo theta, phi, psi;

protected:
    float thetaAngle, phiAngle, psiAngle;
    float circleRadius;
    float a, b, c, d;
    float oth, oph, ops;
    float stepDelta, stepPeriod, stepHeight;
    vector3 circleCenter;
    vector3 position;
    vector3 nDeltaPosition;
    vector3 stepA;
    vector3 stepB;
    
    enum state_t
    {
        neutral,
        stepping
    };
    
    state_t state;

    Timer stepTimer;
    
};

#endif // ROBOTLEG_H