UPennWalkMC.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_UPennWalkMC_h_
00003 #define INCLUDED_UPennWalkMC_h_
00004
00005 #include "Motion/MotionCommand.h"
00006 #include "Motion/MotionManager.h"
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 class UPennWalkMC : public MotionCommand {
00021 public:
00022
00023 UPennWalkMC();
00024
00025 virtual int updateOutputs() {
00026
00027
00028
00029 WalkLegs(xVel,yVel,aVel);
00030 return NumLegJoints;
00031 }
00032
00033 virtual int isDirty() { return true; }
00034 virtual int isAlive() { return true; }
00035
00036 void setTargetVelocity(float x, float y, float a) { xVel=-y; yVel=x; aVel=a; }
00037
00038 protected:
00039 void SetLegJoints(double * x);
00040
00041 inline static double clip(double x, double min=-1.0, double max=1.0)
00042 {
00043 if (x < min) return min;
00044 if (x > max) return max;
00045 return x;
00046 }
00047
00048 void SetStanceParameters(double bodyTilt, double shoulderHeight,
00049 double foreX0, double foreY0,
00050 double hindX0, double hindY0);
00051
00052 void SetWalkSpeeds(int quarterPeriod, double maxDistance,
00053 double foreLiftInitial, double foreLiftFinal,
00054 double hindLiftInitial, double hindLiftFinal);
00055
00056 void SetWalkWorkspace(double foreXMin, double foreXMax,
00057 double foreYMin, double foreYMax,
00058 double hindXMin, double hindXMax,
00059 double hindYMin, double hindYMax);
00060
00061
00062
00063
00064 void LegPositionsToAngles(double *a);
00065
00066 void StandLegs(double x=0, double y=0, double z=0);
00067
00068 int GetWalkPhase();
00069
00070 void SetWalkPhase(int phase);
00071
00072 void WalkLegs(double xWalk=0.0, double yWalk=0.0, double aWalk=0.0);
00073
00074 float xVel;
00075 float yVel;
00076 float aVel;
00077
00078 double body_tilt, shoulder_height;
00079 double fore_x0, fore_y0;
00080 double hind_x0, hind_y0;
00081
00082 int walk_phase, walk_phase_direction, walk_quarter_period;
00083 double walk_max_distance;
00084 double walk_fore_lift_initial, walk_fore_lift_final;
00085 double walk_hind_lift_initial, walk_hind_lift_final;
00086 double walk_current_x[NumLegs], walk_current_y[NumLegs];
00087 double walk_fore_xmin, walk_fore_xmax, walk_fore_ymin, walk_fore_ymax;
00088 double walk_hind_xmin, walk_hind_xmax, walk_hind_ymin, walk_hind_ymax;
00089
00090 };
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 #endif
00109