26 #ifndef _ERRATICDEVICE_H 27 #define _ERRATICDEVICE_H 29 #ifndef ERRATIC_VERSION 30 #define ERRATIC_VERSION "1.0b" 34 #define ERRATIC_DATE "2006-05-07" 41 #include <libplayercore/playercore.h> 42 #include <replace/replace.h> 45 #include "robot_params.h" 49 #define CPU_VOLTAGE 3.5 52 #define ATOR(x) (M_PI * ((double)(x)) / 2048.0) 53 #define ATOD(x) (180.0 * ((double)(x)) / 2048.0) 54 #define RTOA(x) ((short)((x) * 2048.0) / M_PI) 57 #define MOTOR_DEF_MAX_SPEED 0.5 58 #define MOTOR_DEF_MAX_TURNSPEED DTOR(100) 61 #define ROBOT_CYCLETIME 20000 65 #define VIDERE_NOMINAL_VOLTAGE 12.0 69 typedef enum command {
74 set_max_trans_acc = 5,
75 set_max_position_velocity = 6,
101 typedef enum argtype {
120 #define DEFAULT_VIDERE_PORT "/dev/erratic" 132 #include "motorpacket.h" 134 extern bool debug_mode;
142 player_erratic_data_t erratic_data;
151 int position_subscriptions;
152 int aio_ir_subscriptions;
153 int sonar_subscriptions;
154 int ptz_subscriptions;
155 int ptz2_subscriptions;
159 pthread_mutex_t motor_packet_mutex;
164 void ResetRawPositions();
165 void ToggleMotorPower(
unsigned char val);
167 void ToggleAIn(
unsigned char val);
168 void ToggleSonar(
unsigned char val);
176 void PublishAllData();
177 void PublishPosition2D();
183 float IRRangeFromVoltage(
float voltage);
184 float IRFloorRange(
float value);
191 static void *SendThreadDummy(
void *driver);
192 void ReceiveThread();
193 static void *ReceiveThreadDummy(
void *driver);
195 int read_fd, write_fd;
196 const char* psos_serial_port;
201 std::queue<ErraticPacket *> send_queue;
202 pthread_mutex_t send_queue_mutex;
203 pthread_cond_t send_queue_cond;
205 pthread_t send_thread;
206 pthread_t receive_thread;
210 bool direct_wheel_vel_control;
212 bool print_all_packets;
213 bool print_status_summary;
215 bool save_settings_in_robot;
221 int motor_max_turnspeed;
224 int16_t pid_trans_p, pid_trans_v, pid_trans_i;
225 int16_t pid_rot_p, pid_rot_v, pid_rot_i;
228 uint16_t motor_pwm_frequency, motor_pwm_max_on;
234 short motor_max_trans_accel, motor_max_trans_decel;
235 short motor_max_rot_accel, motor_max_rot_decel;
248 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
Command: state (PLAYER_PTZ_CMD_STATE)
Definition: player_interfaces.h:1248
Definition: erratic/motorpacket.h:37
A device address.
Definition: player.h:145
Messages between wsn and a robot.
Definition: er.h:86
Definition: erratic.h:138
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: erratic/packet.h:41
position2d command setting velocity and steering angle
Definition: player_interfaces.h:637
Base class for all drivers.
Definition: driver.h:108
Definition: erratic.h:122
position2d data
Definition: player_interfaces.h:606
Data: state (PLAYER_AIO_DATA_STATE)
Definition: player_interfaces.h:2053
Data: ranges (PLAYER_SONAR_DATA_RANGES)
Definition: player_interfaces.h:771