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;
204 void ResetRawPositions();
205 void ToggleMotorPower(
unsigned char val);
207 void ToggleAIn(
unsigned char val);
208 void ToggleSonar(
unsigned char val);
214 void PublishAllData();
215 void PublishPosition2D();
226 static void *SendThreadDummy(
void *driver);
227 void ReceiveThread();
228 static void *ReceiveThreadDummy(
void *driver);
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;
275 virtual int Shutdown();
Class for loading configuration file information.
Definition: configfile.h:196
position 2d velocity command
Definition: player_interfaces.h:617
Generic message header.
Definition: player.h:161
Definition: mbasedriver.h:159
A device address.
Definition: player.h:145
Messages between wsn and a robot.
Definition: er.h:86
Data: voltage (PLAYER_POWER_DATA_STATE)
Definition: player_interfaces.h:291
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 Movirobotics Player - One Hell of a Robot Server Copy...
Definition: mbase/motorpacket.h:45
position2d command setting velocity and steering angle
Definition: player_interfaces.h:637
Base class for all drivers.
Definition: driver.h:108
position2d data
Definition: player_interfaces.h:606
Definition: mbase/packet.h:48
Data: state (PLAYER_AIO_DATA_STATE)
Definition: player_interfaces.h:2053
Data: ranges (PLAYER_SONAR_DATA_RANGES)
Definition: player_interfaces.h:771