obot_constants.h
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000-2003
00004  *     Brian Gerkey
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * $Id: obot_constants.h 3308 2005-12-09 01:25:10Z gerkey $
00025  *
00026  * Relevant constants for the so-called "Trogdor" robots, by Botrics.
00027  * These values are taken from the 'cerebellum' module of CARMEN; thanks to
00028  * the authors of that module.
00029  */
00030 
00031 #include <math.h>
00032 
00033 #define OBOT_DEFAULT_PORT "/dev/usb/ttyUSB1"
00034 
00035 // might need to define a longer delay to wait for acks
00036 #define OBOT_DELAY_US 50000
00037 
00038 // time between consecutive publishes
00039 #define OBOT_PUBLISH_INTERVAL 0.1
00040 
00041 /************************************************************************/
00042 /* Physical constants, in meters, radians, seconds (unless otherwise noted) */
00043 #define OBOT_AXLE_LENGTH    0.317
00044 #define OBOT_WHEEL_DIAM     0.10795  /* 4.25 inches */
00045 #define OBOT_WHEEL_CIRCUM   (OBOT_WHEEL_DIAM * M_PI)
00046 #define OBOT_TICKS_PER_REV  11600.0
00047 #define OBOT_M_PER_TICK     (OBOT_WHEEL_CIRCUM / OBOT_TICKS_PER_REV)
00048 /* the new internal PID loop runs every 1.9375ms (we think) */
00049 #define OBOT_PID_FREQUENCY  (1/1.9375e-3)
00050 #define OBOT_MAGIC_TIMING_CONSTANT 1.0
00051 #define OBOT_MPS_PER_TICK  (OBOT_M_PER_TICK * OBOT_PID_FREQUENCY / \
00052                                 OBOT_MAGIC_TIMING_CONSTANT)
00053 #define OBOT_WIDTH 0.45
00054 #define OBOT_LENGTH 0.45
00055 #define OBOT_POSE_X 0.0
00056 #define OBOT_POSE_Y 0.0
00057 #define OBOT_POSE_A 0.0
00058 #define OBOT_NOMINAL_VOLTAGE 48.0
00059 
00060 /* assuming that the counts can use the full space of a signed 32-bit int */
00061 #define OBOT_MAX_TICS 2147483648U
00062 
00063 /* for safety */
00064 //#define OBOT_MAX_WHEELSPEED   1.0
00065 #define OBOT_MAX_WHEELSPEED   5.0
00066 
00067 /* to account for our bad low-level PID motor controller */
00068 #define OBOT_MIN_WHEELSPEED_TICKS 5
00069 
00070 /************************************************************************/
00071 /* Comm protocol values */
00072 #define OBOT_ACK   6 // if command acknowledged
00073 #define OBOT_NACK 21 // if garbled message
00074 
00075 #define OBOT_INIT1 253 // The init commands are used in sequence(1,2,3)
00076 #define OBOT_INIT2 252 // to initialize a link to a cerebellum.
00077 #define OBOT_INIT3 251 // It will then blink green and start accepting other 
00078                   // commands.
00079 
00080 #define OBOT_DEINIT 250
00081 
00082 #define OBOT_SET_VELOCITIES 118 // 'v'(left_vel, right_vel) as 16-bit signed ints
00083 #define OBOT_SET_ACCELERATIONS 97 // 'a'(left_accel, right_accel) as 16-bit unsigned ints
00084 #define OBOT_ENABLE_VEL_CONTROL  101 // 'e'()
00085 #define OBOT_DISABLE_VEL_CONTROL 100 // 'd'()
00086 #define OBOT_GET_ODOM            111 // 'o'()->(left_count, right_count, left_vel, right_vel)
00087 #define OBOT_GET_VOLTAGE          98 // 'b'()->(batt_voltage)
00088 #define OBOT_STOP                115 // 's'()  [shortcut for set_velocities(0,0)]
00089 #define OBOT_KILL                107 // 'k'()  [shortcut for disable_velocity_control]
00090 #define OBOT_HEARTBEAT           104 // 'h'() sends keepalive
00091 /************************************************************************/
00092 
00093 

Last updated 12 September 2005 21:38:45