46 #include <replace/replace.h> 47 #include <libplayercore/playercore.h> 49 #include <reb_params.h> 52 #define REB_CONFIG_BUFFER_SIZE 1024 53 #define REB_BAUDRATE B38400 54 #define REB_DEFAULT_SERIAL_PORT "/dev/ttySA1" 56 #define REB_MOTOR_RIGHT 0 57 #define REB_MOTOR_LEFT 2 59 #define REB_BATTERY_CHANNEL 15 64 #define REB_FIXED_FACTOR 10000 66 #define REB_MAX_ACC 100 67 #define REB_MIN_ACC 10 69 #define REB_POS_MODE_STRAIGHT 0 70 #define REB_POS_MODE_ROTATION 1 72 #define REB_IR_START 1 76 #define REB_RESTART_COMMAND "restart\r\n" 77 #define REB_COMMAND_PROMPT ":\r\n" 80 #define ABS(x) ((x) < 0 ? -(x) : (x)) 84 #define SGN(x) ((x) < 0 ? -1 : 1) 109 int ProcessMessage(ClientData * client,
player_msghdr * hdr, uint8_t * data, uint8_t * resp_data,
size_t * resp_len);
112 virtual int Subscribe(player_device_id_t
id);
113 virtual int Unsubscribe(player_device_id_t
id);
122 void SetOdometry(
int,
int,
short);
125 void SetIRState(
int);
127 void UpdateData(
void);
131 void UpdatePosData(player_position_data_t *);
135 void ConfigAD(
int,
int);
136 unsigned short ReadAD(
int);
137 void ReadAllIR(uint16_t * ir);
140 void SetSpeed(
int,
int );
143 void SetPos(
int,
int);
145 void SetPosCounter(
int,
int);
148 unsigned char ReadStatus(
int,
int *,
int *);
149 void ConfigPosPID(
int,
int,
int,
int);
150 void ConfigSpeedPID(
int,
int,
int,
int);
151 void ConfigSpeedProfile(
int,
int,
int);
155 int write_serial(
char *,
int);
156 int read_serial_until(
char *,
int,
char *,
int);
157 int write_command(
char *buf,
int len,
int maxsize);
159 player_device_id_t ir_id;
160 player_device_id_t position_id;
161 player_device_id_t power_id;
163 int ir_subscriptions;
164 int position_subscriptions;
169 struct timeval last_position;
170 bool refresh_last_position;
171 int last_lpos, last_rpos;
172 int last_x_f, last_y_f;
175 struct timeval last_pos_update;
176 struct timeval last_power_update;
177 struct timeval last_ir_update;
179 int pos_update_period;
182 short desired_heading;
185 struct timeval last_ir;
189 bool direct_velocity_control;
192 char reb_serial_port[MAX_FILENAME_SIZE];
194 struct pollfd write_pfd, read_pfd;
197 int ProcessCommand(player_position_cmd_t * poscmd);
198 short last_trans_command, last_rot_command;
199 int leftvel, rightvel;
200 int leftpos, rightpos;
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
Data: voltage (PLAYER_POWER_DATA_STATE)
Definition: player_interfaces.h:291
virtual int MainSetup()
Sets up the resources needed by the driver thread.
Definition: reb.cc:294
Data: ranges (PLAYER_IR_DATA_RANGES)
Definition: player_interfaces.h:2115
virtual void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition: reb.cc:347
virtual void Main()
Main method for driver thread.
Definition: reb.cc:408