34#ifndef _KHEPERADEVICE_H
35#define _KHEPERADEVICE_H
41#include <libplayercore/playercore.h>
43#include "khepera_serial.h"
45#define KHEPERA_CONFIG_BUFFER_SIZE 1024
46#define KHEPERA_BAUDRATE B38400
47#define KHEPERA_DEFAULT_SERIAL_PORT "/dev/ttyUSB0"
48#define KHEPERA_DEFAULT_SCALE 10
49#define KHEPERA_DEFAULT_ENCODER_RES (1.0/12.0)
50#define KHEPERA_DEFAULT_IR_CALIB_A (64.158)
51#define KHEPERA_DEFAULT_IR_CALIB_B (-0.1238)
53#define KHEPERA_MOTOR_LEFT 0
54#define KHEPERA_MOTOR_RIGHT 1
56#define KHEPERA_FIXED_FACTOR 10000
59#define KHEPERA_COMMAND_PROMPT "\r\n"
62#define ABS(x) ((x) < 0 ? -(x) : (x))
66#define SGN(x) ((x) < 0 ? -1 : 1)
76 player_position2d_geom_t position;
100 void SetIRState(
int);
102 void UpdateData(
void);
104 void UpdateIRData(player_ir_data_t *);
105 void UpdatePosData(player_position2d_data_t *);
110 unsigned short ReadAD(
int);
111 int ReadAllIR(player_ir_data_t *);
114 int SetSpeed(
int,
int);
115 int ReadSpeed(
int*,
int*);
117 int SetPos(
int,
int);
119 int SetPosCounter(
int,
int);
120 int ReadPos(
int *,
int*);
130 int position_subscriptions;
131 int ir_subscriptions;
135 player_khepera_geom_t* geometry;
140 struct timeval last_position;
141 bool refresh_last_position;
142 int last_lpos, last_rpos;
144 int last_x_f, last_y_f;
147 struct timeval last_pos_update;
148 struct timeval last_ir_update;
150 int pos_update_period;
152 short desired_heading;
155 struct timeval last_ir;
159 bool direct_velocity_control;
162 char khepera_serial_port[MAX_FILENAME_SIZE];
Class for loading configuration file information.
Definition configfile.h:197
Definition khepera_serial.h:34
virtual int Subscribe(player_devaddr_t addr)
Subscribe to this driver.
Definition khepera.cc:352
virtual int MainSetup()
Sets up the resources needed by the driver thread.
Definition khepera.cc:402
int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition khepera.cc:162
virtual int Unsubscribe(player_devaddr_t addr)
Unsubscribe from this driver.
Definition khepera.cc:375
virtual void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition khepera.cc:426
virtual void Main()
Main method for driver thread.
Definition khepera.cc:442
An autopointer for the message queue.
Definition message.h:74
Base class for drivers which oeprate with a thread.
Definition driver.h:553
Messages between wsn and a robot.
Definition er.h:87
A device address.
Definition player.h:146
Generic message header.
Definition player.h:162