segwayrmp.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "canio.h"
00022 #include "canio_kvaser.h"
00023 #include <libplayercore/playercore.h>
00024
00025
00026
00027 class rmp_frame_t;
00028
00029
00030
00031 class SegwayRMP : public Driver
00032 {
00033 public:
00034
00035 SegwayRMP(ConfigFile* cf, int section);
00036 ~SegwayRMP();
00037
00038
00039 virtual int Setup();
00040 virtual int Shutdown();
00041 virtual int ProcessMessage(QueuePointer & resp_queue,
00042 player_msghdr * hdr,
00043 void * data);
00044
00045 protected:
00046
00047
00048 player_devaddr_t position_id;
00049 player_position2d_data_t position_data;
00050
00051 player_devaddr_t position3d_id;
00052 player_position3d_data_t position3d_data;
00053
00054 player_devaddr_t power_id;
00055 player_power_data_t power_data;
00056
00057 private:
00058
00059 const char* portname;
00060 const char* caniotype;
00061
00062 int timeout_counter;
00063
00064 float max_xspeed, max_yawspeed;
00065
00066 bool firstread;
00067
00068 DualCANIO *canio;
00069
00070 float curr_xspeed, curr_yawspeed;
00071
00072
00073
00074 bool motor_allow_enable;
00075
00076
00077 bool motor_enabled;
00078
00079
00080 uint32_t last_raw_yaw, last_raw_left, last_raw_right, last_raw_foreaft;
00081
00082
00083 double odom_x, odom_y, odom_yaw;
00084
00085
00086 int HandlePositionConfig(QueuePointer &resp_queue, uint32_t subtype, void* data, size_t len);
00087
00088
00089 int HandlePosition3DConfig(QueuePointer &resp_queue, uint32_t subtype, void* data, size_t len);
00090
00091
00092 int Read();
00093
00094
00095
00096 int Diff(uint32_t from, uint32_t to, bool first);
00097
00098
00099 int Write(CanPacket& pkt);
00100
00101
00102 virtual void Main();
00103
00104
00105 void MakeStatusCommand(CanPacket* pkt, uint16_t cmd, uint16_t val);
00106
00107
00108 void MakeVelocityCommand(CanPacket* pkt, int32_t xspeed, int32_t yawspeed);
00109
00110 void MakeShutdownCommand(CanPacket* pkt);
00111
00112 void UpdateData(rmp_frame_t *);
00113 };
00114
00115
Last updated 12 September 2005 21:38:45
|