Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

rflex_configs.h

Go to the documentation of this file.
00001 /* some basic structures and conversions needed by everything
00002  *
00003  * data for the conversions and everything else will be grabbed out of
00004  * the general configuration file
00005  *
00006  * note - they way it is now is the right way to do it, BUT:
00007  * if your a hacker and want things to run fast - put all the configurations
00008  * here as #define's, this will allow the precompiler to precompute combined
00009  * conversions, this is much preferable to modifying the rest of the code
00010  * if you really need the speed that badly
00011  */
00012 
00013 // NOTICE! - this file declares rflex_configs extern, intended to link to 
00014 // the rflex_configs declared in rflex.cc
00015 
00016 #ifndef RFLEX_CONFIGS_H
00017 #define RFLEX_CONFIGS_H
00018 
00019 #include <math.h>
00020 #include <player.h>
00021 
00022 //holds the pose of a sonar in robot relative coordinates
00023 typedef struct
00024 {
00025   double x;
00026   double y;
00027   double t;
00028 } sonar_pose_t;
00029 
00030 //normalizes an angle in radians to -M_PI<theta<M_PI
00031 inline double normalize_theta(double theta){
00032   while(theta>M_PI)
00033     theta-=2*M_PI;
00034   while(theta<-M_PI)
00035     theta+=2*M_PI;
00036   return theta;
00037 }
00038 
00039 //structures for holding general configuration of robot
00040 typedef struct rflex_config_t{
00041   char serial_port[256];
00042   //length of the robot in mm
00043   double mm_length;
00044   //width of the robot in mm
00045   double mm_width;
00046   //mm*odo_distance_conversion : mm to rflex arbitrary odometry units (trans)
00047   double odo_distance_conversion;
00048   //rad*odo_angle_conversion : rad to rflex arbitrary odometry units (rot)
00049   double odo_angle_conversion;
00050   //mm*range_distance_conversion : mm to rflex arbitrary range units
00051   double range_distance_conversion;
00052   //default translational acceleration in mm/sec
00053   double mmPsec2_trans_acceleration;
00054   //default rotational acceleration in rad/sec
00055   double radPsec2_rot_acceleration;
00056   
00057   // use rflex joystick to command robot?
00058   bool use_joystick;
00059   double joy_pos_ratio, joy_ang_ratio;
00060   
00061   
00062   
00063   //maximum number of sonar supported by modules
00064   //(generally 16*number of sonar controller boards, or banks)
00065   int max_num_sonars;
00066   //total number of physical sonar
00067   int num_sonars;
00068   //how long to buffer for filter (filter just takes smallest of last n readings)
00069   int sonar_age;
00070   //number of physical sonar sonar controller boards or banks on your robot
00071   int num_sonar_banks;
00072   // number of sonars that can be attached to each sonar controller (16)
00073   int num_sonars_possible_per_bank;
00074   // number of actual sonar attached to each sonar controller, (in each bank)
00075   int *num_sonars_in_bank;
00076   // pose of each sonar on the robot (x,y,t) in rad and mm
00077   // note i is forwards, j is left
00078   sonar_pose_t *mmrad_sonar_poses;
00079   //not sure what these do yet actually
00080   long sonar_echo_delay;
00081   long sonar_ping_delay;
00082   long sonar_set_delay;
00083   // options to support 2nd sonar bank
00084   long sonar_2nd_bank_start;
00085   long sonar_1st_bank_end;
00086 
00087   
00088   // bumper configs
00089   unsigned short bumper_count;
00090   int bumper_address;
00092   int bumper_style;
00093   player_bumper_define_t * bumper_def;
00094 
00095   // power configs
00096   int power_offset;
00097   
00098   // ir configs
00099   player_ir_pose_t ir_poses;
00100   int ir_base_bank;
00101   int ir_bank_count;
00102   int * ir_count; 
00103   double * ir_a; 
00104   double * ir_b; 
00105   int ir_min_range;
00106   int ir_max_range;
00107 }  rflex_config_t;
00108 
00109 //notice - every file that includes this header gets a GLOBAL rflex_configs!!
00110 // be careful
00111 extern rflex_config_t rflex_configs;
00112 
00113 /************ conversions ********************/
00114 /*** rather obvious - ARB stands for arbitrary (look above) ***/
00115 
00116 //player uses degrees, but I use radians (so cos, and sin work correctly)
00117 #define RAD2DEG_CONV(x)  ((x)*(180/M_PI))
00118 #define DEG2RAD_CONV(x) ((x)*(M_PI/180))
00119 #define ARB2RAD_ODO_CONV(x) ((x)/rflex_configs.odo_angle_conversion)
00120 #define RAD2ARB_ODO_CONV(x) ((x)*rflex_configs.odo_angle_conversion)
00121 #define ARB2MM_ODO_CONV(x) ((x)/rflex_configs.odo_distance_conversion)
00122 #define MM2ARB_ODO_CONV(x) ((x)*rflex_configs.odo_distance_conversion)
00123 
00124 #define ARB2MM_RANGE_CONV(x) (x/rflex_configs.range_distance_conversion)
00125 #define MM2ARB_RANGE_CONV(x) (x*rflex_configs.range_distance_conversion)
00126 
00127 #endif
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 

Generated on Tue May 3 14:15:36 2005 for Player by doxygen 1.3.6