31 #ifndef _CLODBUSTERDEVICE_H 32 #define _CLODBUSTERDEVICE_H 37 #include <libplayercore/playercore.h> 40 #define CLODBUSTER_CYCLETIME_USEC 50000 45 #define SET_SERVO_THROTTLE 0 46 #define SET_SERVO_FRONTSTEER 1 47 #define SET_SERVO_BACKSTEER 2 48 #define SET_SERVO_PAN 3 50 #define ECHO_SERVO_VALUES 64 // 0x40 51 #define ECHO_MAX_SERVO_LIMITS 65 //0x41 52 #define ECHO_MIN_SERVO_LIMITS 66 //0x42 53 #define ECHO_CEN_SERVO_LIMITS 67 //0x43 55 #define ECHO_ENCODER_COUNTS 112 // 0x70 56 #define ECHO_ENCODER_COUNTS_TS 113 // 0x71 57 #define ECHO_ADC 128 //0x80 60 #define SET_SLEEP_MODE 144 // 0x90 61 #define ECHO_SLEEP_MODE 145 // 0x91 63 #define SLEEP_MODE_ON 1 64 #define SLEEP_MODE_OFF 0 66 #define SERVO_CHANNELS 8 70 #define ARGINT 0x3B // Positive int (LSB, MSB) 71 #define ARGNINT 0x1B // Negative int (LSB, MSB) 72 #define ARGSTR 0x2B // String (Note: 1st byte is length!!) 74 #define CLODBUSTER_CONFIG_BUFFER_SIZE 256 76 #define DEFAULT_CLODBUSTER_PORT "/dev/ttyUSB0" // This has to be USB - serial port. 87 float kp, ki, kd, freq, k1, k2, k3;
91 k1 = kp + .5*T*ki + kd/T;
92 k2 = -kp - 2.0*kd/T + .5*ki*T;
94 printf(
"Gain constants set to K1 = %f, K2 = %f, K3 = %f\n",k1,k2,k3);
97 PIDGains(
float kp_,
float ki_,
float kd_,
float freq_)
98 :kp(kp_), ki(ki_), kd(kd_),freq(freq_)
118 void SetFreq(
float f)
123 float K1(){
return(k1);};
124 float K2(){
return(k2);};
125 float K3(){
return(k3);};
132 void ResetRawPositions();
133 clodbuster_encoder_data_t ReadEncoders();
138 char clodbuster_serial_port[MAX_FILENAME_SIZE];
144 clodbuster_encoder_data_t encoder_offset;
145 clodbuster_encoder_data_t encoder_measurement;
146 clodbuster_encoder_data_t old_encoder_measurement;
147 float EncV, EncOmega, EncVleft, EncVright;
149 bool direct_command_control;
150 unsigned char max_limits[SERVO_CHANNELS],center_limits[SERVO_CHANNELS],min_limits[SERVO_CHANNELS];
151 void GetGraspBoardParams();
156 float WheelSeparation;
157 unsigned int CountsPerRev;
164 void IntegrateEncoders();
165 void DifferenceEncoders();
171 int motor_max_turnspeed;
176 short speedDemand, turnRateDemand;
177 bool newmotorspeed, newmotorturn;
190 virtual int MainSetup();
191 virtual void MainQuit();
193 unsigned char SetServo(
unsigned char chan,
int value);
194 void SetServo(
unsigned char chan,
unsigned char cmd);
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
Definition: clodbuster.h:128
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
Definition: clodbuster.h:78
Messages between wsn and a robot.
Definition: er.h:86
An autopointer for the message queue.
Definition: message.h:73
position2d data
Definition: player_interfaces.h:606
Definition: clodbuster.h:84