37 #ifndef _mbasedriverDEVICE_H 38 #define _mbasedriverDEVICE_H 40 #ifndef mbasedriver_VERSION 41 #define mbasedriver_VERSION "2.0" 44 #ifndef mbasedriver_DATE 45 #define mbasedriver_DATE "2010-08-31" 49 #define mbase_author "Hernandez Malagon, Ana Teresa" 57 #include <libplayercore/playercore.h> 58 #include <replace/replace.h> 61 #include "robot_params.h" 65 #define GradToRad(x) (M_PI * ((double)(x)) / 180.0) 66 #define RadToGrad(x) ((short)((x) * 180.0) / M_PI) 69 #define ATOR(x) (M_PI * ((double)(x)) / 2048.0) 70 #define ATOD(x) (180.0 * ((double)(x)) / 2048.0) 71 #define RTOA(x) ((short)((x) * 2048.0) / M_PI) 74 #define MOTOR_DEF_MAX_SPEED 0.5 75 #define MOTOR_DEF_MAX_TURNSPEED DTOR(100) 78 #define ROBOT_CYCLETIME 20000 81 #define VIDERE_NOMINAL_VOLTAGE 13.0 84 #define MOTOR_MAX_TRANS_ACEL 1500 85 #define MOTOR_DEF_TRANS_ACEL 500 87 #define MOTOR_DEF_MAX_ROT_ACEL 135 92 #define ROBOT_WHEEL_MR5 190 93 #define ROBOT_WHEEL_MR7 310 94 #define ROBOT_WIDTH_MR5 410 95 #define ROBOT_WIDTH_MR7 495 104 #define FREC_OSC_MICRO 3.6864 105 #define FACTOR_ESCALA 256 115 open_controller = 0x01,
116 close_controller = 0x02,
117 enable_motors = 0x04,
127 set_trans_acel = 0x5A,
129 set_driffactor = 0x5C,
130 set_robot_width = 0x5D,
131 set_robot_wheel = 0x5E,
132 set_odometria = 0x5F,
137 typedef enum argtype {
157 #define DEFAULT_VIDERE_PORT "/dev/ttyS0" 169 #include "motorpacket.h" 171 extern bool debug_mbasedriver;
172 extern bool debug_send;
173 extern bool debug_receive_aio;
174 extern bool debug_receive_sonar;
175 extern bool debug_receive_motor;
176 extern bool debug_susbcribe;
177 extern bool debug_mbase_send_msj;
185 player_mbasedriver_data_t mbasedriver_data;
193 int position_subscriptions;
194 int aio_ir_subscriptions;
195 int sonar_subscriptions;
199 pthread_mutex_t motor_packet_mutex;
230 int read_fd, write_fd;
231 const char* psos_serial_port;
236 std::queue<mbasedriverPacket *> send_queue;
237 pthread_mutex_t send_queue_mutex;
238 pthread_cond_t send_queue_cond;
240 pthread_t send_thread;
241 pthread_t receive_thread;
244 bool print_all_packets;
249 int motor_max_turnspeed;
254 int motor_trans_acel;
258 int16_t pid_p, pid_v, pid_i;
Class for loading configuration file information.
Definition: configfile.h:196
position 2d velocity command
Definition: player_interfaces.h:617
virtual int Subscribe(player_devaddr_t id)
Subscribe.
Definition: mbasedriver.cc:772
Generic message header.
Definition: player.h:161
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
ProcessMessage.
Definition: mbasedriver.cc:1345
void ResetRawPositions()
ResetRawPositions.
Definition: mbasedriver.cc:1102
int HandleConfig(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
HandleConfig.
Definition: mbasedriver.cc:1361
virtual void Main()
Main.
Definition: mbasedriver.cc:1195
int Connect()
Connect.
Definition: mbasedriver.cc:381
virtual int Shutdown()
Shutdown.
Definition: mbasedriver.cc:692
int getms()
getms
Definition: mbasedriver.cc:1520
void PublishSonar()
PublishSonar.
Definition: mbasedriver.cc:1317
Definition: mbasedriver.h:159
A device address.
Definition: player.h:145
void Send(mbasedriverPacket *packet)
Send.
Definition: mbasedriver.cc:1090
void StopThreads()
StopThreads.
Definition: mbasedriver.cc:755
Messages between wsn and a robot.
Definition: er.h:86
Data: voltage (PLAYER_POWER_DATA_STATE)
Definition: player_interfaces.h:291
void PublishIR()
PublishIR.
Definition: mbasedriver.cc:1303
An autopointer for the message queue.
Definition: message.h:73
Data: ranges (PLAYER_IR_DATA_RANGES)
Definition: player_interfaces.h:2115
Definition: mbasedriver.h:181
Copyright (C) 2010 Ana Teresa Hernández Malagón anat.hernandezm@gmail.com Movirobotics athernandez@...
Definition: mbase/motorpacket.h:45
int HandleCommand(player_msghdr *hdr, void *data)
HandleCommand.
Definition: mbasedriver.cc:1622
void HandlePositionCommand(player_position2d_cmd_vel_t position_cmd)
HandlePositionCommand.
Definition: mbasedriver.cc:1532
virtual int Setup()
Setup.
Definition: mbasedriver.cc:371
position2d command setting velocity and steering angle
Definition: player_interfaces.h:637
void ReceiveThread()
ReceiveThread.
Definition: mbasedriver.cc:849
Base class for all drivers.
Definition: driver.h:108
static void * ReceiveThreadDummy(void *driver)
ReceiveThreadDummy.
Definition: mbasedriver.cc:1030
virtual int Unsubscribe(player_devaddr_t id)
Unsubscribe.
Definition: mbasedriver.cc:812
void ToggleMotorPower(unsigned char val)
ToggleMotorPower.
Definition: mbasedriver.cc:1126
int Disconnect()
Disconnect.
Definition: mbasedriver.cc:703
void ToggleAIn(unsigned char val)
ToggleAIn.
Definition: mbasedriver.cc:1150
position2d data
Definition: player_interfaces.h:606
void ToggleSonar(unsigned char val)
ToggleSonar.
Definition: mbasedriver.cc:1172
mbasedriver(ConfigFile *cf, int section)
Definition: mbasedriver.cc:209
void PublishAIn()
PublishAIn.
Definition: mbasedriver.cc:1289
Definition: mbase/packet.h:48
void StartThreads()
StrarThreads.
Definition: mbasedriver.cc:746
void PublishAllData()
PublishAllData.
Definition: mbasedriver.cc:1331
void PublishPosition2D()
PublishPosition2D.
Definition: mbasedriver.cc:1261
void SendThread()
SendThread.
Definition: mbasedriver.cc:1039
void PublishPower()
PublishPower.
Definition: mbasedriver.cc:1275
Data: state (PLAYER_AIO_DATA_STATE)
Definition: player_interfaces.h:2053
static void * SendThreadDummy(void *driver)
SedThreadDummy.
Definition: mbasedriver.cc:1079
Data: ranges (PLAYER_SONAR_DATA_RANGES)
Definition: player_interfaces.h:771