00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _RWI_POSITIONDEVICE_H
00031 #define _RWI_POSITIONDEVICE_H
00032
00033 #include <rwidevice.h>
00034 #include <drivertable.h>
00035
00036 class CRWIPositionDevice: public CRWIDevice {
00037 public:
00038 CRWIPositionDevice (char* interface, ConfigFile* cf, int section)
00039 : CRWIDevice(interface, cf, section,
00040 sizeof(player_position_data_t),
00041 sizeof(player_position_cmd_t),
00042 1,1),
00043 old_xpos(0),
00044 old_ypos(0),
00045 old_theta(0),
00046 moving(false),
00047 last_known_speed(0),
00048 last_known_turnrate(0)
00049 {}
00050
00051 virtual int Setup ();
00052 virtual int Shutdown ();
00053
00054 virtual void Main ();
00055
00056 private:
00057
00058 #ifdef USE_MOBILITY
00059 MobilityActuator::ActuatorState_var base_state;
00060 MobilityActuator::ActuatorState_var odo_state;
00061
00062
00063 double odo_correct_x, odo_correct_y, odo_correct_theta;
00064 #endif // USE_MOBILITY
00065
00066
00067 int32_t old_xpos, old_ypos;
00068 int32_t old_theta;
00069 bool moving;
00070
00071
00072 uint32_t last_known_speed;
00073 int32_t last_known_turnrate;
00074
00075 void PositionCommand (const int32_t speed, const int32_t rot_speed);
00076 void ResetOdometry ();
00077 };
00078
00079 #endif // _RWI_POSITIONDEVICE_H
00080