mRunCtrl.h
Go to the documentation of this file.00001 #ifndef M_RUN_CTROL_H
00002 #define M_RUN_CTROL_H
00003
00013 #include "vmonitor.h"
00014 #include "tRunCtrlSimulator.h"
00015
00016
00020 class mRunCtrl : public RunCtrl {
00021 vmonitor* mon;
00022 int MonitorMode;
00023 SDL_cond* cond;
00024 SDL_mutex* mutex;
00025 tRunCtrl_Simulator* simulator;
00026 static bool isVersionPrinted;
00027 static bool isHelpPrinted;
00028 void printVersion(void);
00029 void printHelp(void);
00030 void parseArgs(int argc, char* argv[]);
00031 unsigned long getHostTicks(void);
00032
00033 void writeLocalPosition(const VXV::Position3D& ret_pos, unsigned long ticks);
00034 void readLocalPosition(VXV::Position& ret_pos);
00035 void writeIsStable(bool ret_value, unsigned long ticks);
00036 bool readIsStable(void);
00037 void pauseLock(void);
00038 void pauseUnlock(void);
00039
00040 public:
00041 tRunCtrl_Simulator::TicksPosition& ticksPos;
00043 mRunCtrl(void);
00044 virtual ~mRunCtrl(void);
00045
00049 int connect(void);
00050
00057 int connect(const char* device, long baudrate = Baudrate);
00058
00065 int connect(int argc, char *argv[]);
00066
00072 void adjustOwnTicks(unsigned long setTicks);
00073
00077 VXV::Position3D getLocalPosition(void);
00078
00082 void stop(void);
00083
00090 void followLine(const VXV::Position& position,
00091 const CoordinateCtrl* crd = VXV::GL);
00092
00100 void followCircle(const VXV::Grid& center, int radius,
00101 const CoordinateCtrl* crd = VXV::GL);
00102
00110 void followCircleOnTangent(const VXV::Position& position, int radius,
00111 const CoordinateCtrl* crd = VXV::GL);
00112
00119 void stopToLine(const VXV::Position& position,
00120 const CoordinateCtrl* crd = VXV::GL);
00121
00128 void rotateToDirection(const VXV::Direction& direction,
00129 const CoordinateCtrl* crd = VXV::GL);
00130
00131
00137 void rotateAngle(const VXV::Direction& direction);
00138
00144 void spin(const VXV::Direction& velocity);
00145
00151 void lastMoveCommand(const CoordinateCtrl* crd = VXV::GL);
00152
00153
00157 bool isStable(void);
00158
00159 void servoCtrl(bool on);
00160
00167 void setMotorPwm(int id, unsigned char duty);
00168
00176 void setMotorPwm(int id, unsigned char duty[], int nums);
00177
00184 void setMotorMode(int id, unsigned char mode);
00185
00193 void setMotorMode(int id, unsigned char mode[], int nums);
00194
00195
00196
00197
00198
00205 void setWheelVel(int id, int mm_vel);
00206
00214 void setWheelVel(int id, int mm_vel[], int nums);
00215 };
00216
00217 #endif
00218