00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "jwalkincludes.h"
00011 #include "actuators.h"
00012
00013 #define ALWALK_VERBOSITY 3
00014
00015 #define CONFIG_LOCATION string("/home/root/jasondata/alwalkconfig/")
00016
00017 enum ALWalkPrimitiveEnum
00018 {
00019 ALWALK_PRIMITIVE_FORWARD,
00020 ALWALK_PRIMITIVE_BACKWARD,
00021 ALWALK_PRIMITIVE_ARC,
00022 ALWALK_PRIMITIVE_SIDEWAYS,
00023 ALWALK_PRIMITIVE_TURN,
00024 ALWALK_NUM_PRIMITIVES
00025 };
00026
00027 enum ALWalkDirectionEnum
00028 {
00029 ALWALK_DIRECTION_UNDEFINED,
00030 ALWALK_DIRECTION_FORWARD,
00031 ALWALK_DIRECTION_BACKWARD,
00032 ALWALK_DIRECTION_ARC,
00033 ALWALK_DIRECTION_LEFT,
00034 ALWALK_DIRECTION_RIGHT,
00035 ALWALK_DIRECTION_TURN_LEFT,
00036 ALWALK_DIRECTION_TURN_RIGHT,
00037 ALWALK_NUM_DIRECTIONS
00038 };
00039
00040 struct alwalkconfig_t
00041 {
00042 float Hardnesses[ALIAS_TARGETS_NOT_HEAD_LENGTH];
00043 int CyclesPerStep;
00044 float StepLength;
00045 float StepHeight;
00046 float StepSide;
00047 float StepTurn;
00048 float ZMPX;
00049 float ZMPY;
00050 float LHipBacklash;
00051 float RHipBacklash;
00052 float HipHeight;
00053 float TorsoOrientation;
00054 float DistanceCommandFactor;
00055 float AngleCommandFactor;
00056 float DistanceOdometryFactor;
00057 float AngleOdometryFactor;
00058 };
00059
00060 class ALWalk
00061 {
00062 public:
00063 ALWalk();
00064 ~ALWalk();
00065
00066 void setStiffnessNotHead(float values[]);
00067 int goToAnglesNotHead(float positions[], int time);
00068 int goToAnglesWithVelocityNotHead(float positions[], float velocity);
00069
00070 void walkStraight(float distance);
00071 void walkArc(float angle, float radius);
00072 void walkSideways(float distance);
00073 void turn(float angle);
00074
00075 void goForward();
00076 void goBackward();
00077 void goArc(float angle);
00078 void goLeft();
00079 void goRight();
00080 void goTurnLeft();
00081 void goTurnRight();
00082 bool gIsActive();
00083
00084 bool walkIsActive();
00085 void waitUntilFinished();
00086 void stop();
00087
00088 void innerTest();
00089
00090 private:
00091
00092 void initSelf();
00093 void readConfigs();
00094 void readConfig(string name, alwalkconfig_t* config);
00095 int lineToFloats(string line, float values[]);
00096
00097 void configALMotion(ALWalkPrimitiveEnum primitive);
00098 public:
00099 float *alWalkHardnesses;
00100 private:
00101 alwalkconfig_t alWalkConfigs[ALWALK_NUM_PRIMITIVES];
00102 ALWalkDirectionEnum alWalkGoDirection;
00103
00104
00105 };
00106
00107
00108