00001 /** 00002 \file Robots/LoBot/irccm/LoOpenInterface.h 00003 \brief Definitions for some of the Open Interface stuff used by the 00004 lobot low-level controller. 00005 */ 00006 00007 /* 00008 ************************************************************************ 00009 * The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 * 00010 * by the University of Southern California (USC) and the iLab at USC. * 00011 * See http: iLab.usc.edu for information about this project. * 00012 * * 00013 * Major portions of the iLab Neuromorphic Vision Toolkit are protected * 00014 * under the U.S. patent ``Computation of Intrinsic Perceptual Saliency * 00015 * in Visual Environments, and Applications'' by Christof Koch and * 00016 * Laurent Itti, California Institute of Technology, 2001 (patent * 00017 * pending; application number 09/912,225 filed July 23, 2001; see * 00018 * http: pair.uspto.gov/cgi-bin/final/home.pl for current status). * 00019 ************************************************************************ 00020 * This file is part of the iLab Neuromorphic Vision C++ Toolkit. * 00021 * * 00022 * The iLab Neuromorphic Vision C++ Toolkit is free software; you can * 00023 * redistribute it and/or modify it under the terms of the GNU General * 00024 * Public License as published by the Free Software Foundation; either * 00025 * version 2 of the License, or (at your option) any later version. * 00026 * * 00027 * The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope * 00028 * that it will be useful, but WITHOUT ANY WARRANTY; without even the * 00029 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * 00030 * PURPOSE. See the GNU General Public License for more details. * 00031 * * 00032 * You should have received a copy of the GNU General Public License * 00033 * along with the iLab Neuromorphic Vision C++ Toolkit; if not, write * 00034 * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * 00035 * Boston, MA 02111-1307 USA. * 00036 ************************************************************************ 00037 */ 00038 00039 /* 00040 Primary maintainer for this file: Manu Viswanathan <mviswana at usc dot edu> 00041 $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/irccm/LoOpenInterface.h $ 00042 $Id: LoOpenInterface.h 12717 2010-01-29 15:01:45Z mviswana $ 00043 */ 00044 00045 #ifndef LOBOT_IRCCM_OPEN_INTERFACE_DOT_H 00046 #define LOBOT_IRCCM_OPEN_INTERFACE_DOT_H 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 /*----------------------------- CONSTANTS -----------------------------*/ 00053 00054 /// These enumerations are for the different Open Interface commands that 00055 /// the iRobot Create understands. 00056 enum { 00057 /// This command starts the Open Interface. The robot expects to be 00058 /// sent this command before it will start recognizing and responding 00059 /// to any other Open Interface commands. 00060 LOBOT_OI_CMD_START = 128, 00061 00062 /// This command sets the baud rate at which Open Interface commands 00063 /// and data are sent. It expects a one-byte baud rate code parameter 00064 /// to be sent along with the command. 00065 /// 00066 /// The default baud rate on power up is 57,600 bits per second. 00067 /// However, if the user holds down the Play button while powering on 00068 /// the Create, the baud rate will be set to 19,200 bps. 00069 /// 00070 /// Once the baud rate is set/changed, it remains in effect until the 00071 /// robot is power-cycled or until its battery removed or until the 00072 /// battery voltage drops below the minimum required for processor 00073 /// operation. 00074 /// 00075 /// After sending this command, be sure to wait at least 100ms for the 00076 /// baud rate change to take effect and for subsequent commands and 00077 /// data to be sent at the new baud rate. Moreover, at the maximum 00078 /// supported baud rate of 115,200 bps, be sure to wait at least 200 00079 /// microseconds between consecutive send operations. 00080 /// 00081 /// DEVNOTE: This file defines symbolic constants for the supported 00082 /// baud rate codes and the corresponding values for the baud rate 00083 /// register UBRR0. 00084 LOBOT_OI_CMD_BAUD = 129, 00085 00086 /// The Create has four operating modes, viz., Off, Passive, Safe and 00087 /// Full. 00088 /// 00089 /// In Passive mode, user programs can request sensor data and have 00090 /// the robot perfom any of its built-in demos, but cannot issue motor 00091 /// or actuator commands. The robot always powers up in Passive mode. 00092 /// 00093 /// In Safe mode, user programs have full control of the robot except 00094 /// when a cliff or wheel drop is detected. When that happens, the 00095 /// robot will immediately shut off its motors and revert to Passive 00096 /// mode. The same thing happens when the robot detects that its 00097 /// charger is plugged in. 00098 /// 00099 /// In Full mode, user programs have full control of the robot and it 00100 /// is up to user programs to detect and respond to cliff, wheel drop 00101 /// and charging events. 00102 //@{ 00103 LOBOT_OI_CMD_PASSIVE = LOBOT_OI_CMD_START, 00104 LOBOT_OI_CMD_SAFE = 131, 00105 LOBOT_OI_CMD_FULL = 132, 00106 //@} 00107 00108 /// This command can be used to run one of the built-in demo programs. 00109 /// It expects a one-byte parameter specifying the demo number. 00110 /// 00111 /// NOTE: This command will put the robot into Passive mode. 00112 /// 00113 /// DEVNOTE: This file defines symbolic constants for the demo 00114 /// numbers. 00115 LOBOT_OI_CMD_DEMO = 136, 00116 00117 /// These commands can be used to run some of the demos directly 00118 /// (i.e., without having to use LOBOT_OI_CMD_DEMO + demo number). 00119 //@{ 00120 LOBOT_OI_CMD_DEMO_SPOT = 134, 00121 LOBOT_OI_CMD_DEMO_COVER = 135, 00122 LOBOT_OI_CMD_DEMO_COVER_AND_DOCK = 143, 00123 //@} 00124 00125 /// This command controls the Create's drive wheels. It expects four 00126 /// data bytes. The first two data bytes specify the average speed of 00127 /// the drive wheels in mm/s. The next two data bytes specify the turn 00128 /// radius in mm. 00129 /// 00130 /// Both parameters are interpreted as signed 16-bit integers, high 00131 /// byte first. Positive values of the speed parameter result in the 00132 /// Create driving forwards while negative values result in it backing 00133 /// up. Positive values of the turn parameter result in left (ccw) 00134 /// turns and negative turn radii result in right (cw) turns. The turn 00135 /// radius is measured from the center of the robot to the center of 00136 /// the turning circle. 00137 /// 00138 /// The speed parameter must lie in the range [-500, 500] and the turn 00139 /// radius parameter in the range [-2000, 2000]. Larger turn radii 00140 /// result in the Create driving straighter whereas short turn radii 00141 /// cause the Create to execute sharp turns. Special values are used 00142 /// to indicate in-place turns and to drive straight ahead without 00143 /// turning. 00144 /// 00145 /// DEVNOTE: This file defines symbolic constants for the turn radius 00146 /// special cases. 00147 LOBOT_OI_CMD_DRIVE = 137, 00148 00149 /// This command allows independent control of the two drive wheels. 00150 /// It expects four data bytes. The first two bytes are a signed 00151 /// 16-bit integer (high byte first) specifying the speed (mm/s) for 00152 /// the right wheel and the other two data bytes are the same thing 00153 /// for the left wheel. 00154 /// 00155 /// Positive values for a given parameter will make that wheel drive 00156 /// forwards, negative values will make it go backwards. Both speed 00157 /// parameters must lie in the range [-500, 500]. 00158 LOBOT_OI_CMD_DRIVE_DIRECT = 145, 00159 00160 /// This command controls the LEDs on the Create. It expects three 00161 /// data bytes. The first byte specifies the state of the Play and 00162 /// Advance LEDs. The second byte specifies the color of the Power LED 00163 /// and the third byte specifies the Power LED's intensity. 00164 /// 00165 /// Play and Advance LEDs: bit #1 is for the Play LED and bit #3 is 00166 /// for the Advance LED. If these bits are set to one, the respective 00167 /// LEDs will be on; if they are zero, the LEDs will be off. This file 00168 /// defines appropriate constants and masks for these LEDs. 00169 /// 00170 /// The Power LED: the second and third data bytes for this command 00171 /// are both unsigned numbers in the range [0, 255]. The second byte 00172 /// specifies the Power LED's color, which can glow green (0) to red 00173 /// (255). Intermediate values will result in colors such as orange, 00174 /// yellow, etc. 00175 /// 00176 /// The third byte controls the intensity with which the Power LED 00177 /// should glow. Zero means off, 255 means full intensity; 00178 /// intermediate values result in intermediate intensities. 00179 LOBOT_OI_CMD_LEDS = 139, 00180 00181 /// This command defines a "song" for the robot to play at some later 00182 /// time. The robot supports up to 16 such songs. Each song can 00183 /// contain up to 16 notes. A note is specified using MIDI note 00184 /// definitions plus a duration specified in fractions of a second. 00185 /// 00186 /// This command expects a series of data bytes. The first byte must 00187 /// specify the song ID (0 to 15) and the second byte specifies the 00188 /// number of notes the song contains (1 to 16). Thereafter, come the 00189 /// notes in byte pairs (first the MIDI note number and the next the 00190 /// duration). 00191 LOBOT_OI_CMD_DEFINE_SONG = 140, 00192 00193 /// This commands plays a song defined earlier with the SONG command. 00194 /// It expects one data byte, viz., the song number (0 to 15) to play. 00195 /// 00196 /// NOTE: The PLAY_SONG command won't work if another song is 00197 /// currently playing. The "song playing" sensor packet can be used to 00198 /// check whether the Create is ready to accept this command or not. 00199 LOBOT_OI_CMD_PLAY_SONG = 141, 00200 00201 /// This command requests the robot to send a packet of sensor data 00202 /// bytes. There are 43 differenct snsor data packets. Each such 00203 /// packet provides the value(s) of a specific sensor or group of 00204 /// sensors. 00205 /// 00206 /// The commands expects one data byte, viz., the sensor packet ID. 00207 /// 00208 /// NOTE: Sensor queries should not be sent faster than 67Hz. That is, 00209 /// consecutive sensor queries should be at least 15ms apart. 00210 /// 00211 /// DEVNOTE: This file defines constants for the different sensor 00212 /// packets. 00213 LOBOT_OI_CMD_SENSORS = 142, 00214 00215 /// This command requests a list of specific sensor packets instead of 00216 /// the predefined groups or single sensor values as in the SENSORS 00217 /// command. The robot returns the sensor packets in the order 00218 /// specified by the command. 00219 /// 00220 /// The command expects a series of data bytes. The first data byte 00221 /// must specify the number of sensor packets being requested. The 00222 /// remaining data bytes specify the desired packet IDs. 00223 /// 00224 /// NOTE: Sensor queries should not be sent faster than 67Hz. That is, 00225 /// consecutive sensor queries should be at least 15ms apart. 00226 /// 00227 /// DEVNOTE: This file defines constants for the different sensor 00228 /// packets. 00229 LOBOT_OI_CMD_QUERY_LIST = 149, 00230 } ; 00231 00232 /// Enumerations for the supported baud rates. When the BAUD command is 00233 /// issued, the following data byte should be one of these values. 00234 enum { 00235 LOBOT_OI_BAUD_300, 00236 LOBOT_OI_BAUD_600, 00237 LOBOT_OI_BAUD_1200, 00238 LOBOT_OI_BAUD_2400, 00239 LOBOT_OI_BAUD_4800, 00240 LOBOT_OI_BAUD_9600, 00241 LOBOT_OI_BAUD_14400, 00242 LOBOT_OI_BAUD_19200, 00243 LOBOT_OI_BAUD_28800, 00244 LOBOT_OI_BAUD_38400, 00245 LOBOT_OI_BAUD_57600, 00246 LOBOT_OI_BAUD_115200, 00247 } ; 00248 00249 /// Enumerations for the baud rate register values. When setting up the 00250 /// Open Interface baud rate, the UBRR0 register will have to take on one 00251 /// of these values. 00252 enum { 00253 LOBOT_OI_UBRR_300 = 3839, 00254 LOBOT_OI_UBRR_600 = 1919, 00255 LOBOT_OI_UBRR_1200 = 959, 00256 LOBOT_OI_UBRR_2400 = 479, 00257 LOBOT_OI_UBRR_4800 = 239, 00258 LOBOT_OI_UBRR_9600 = 119, 00259 LOBOT_OI_UBRR_14400 = 79, 00260 LOBOT_OI_UBRR_19200 = 59, 00261 LOBOT_OI_UBRR_28800 = 39, 00262 LOBOT_OI_UBRR_38400 = 29, 00263 LOBOT_OI_UBRR_57600 = 19, 00264 LOBOT_OI_UBRR_115200 = 9, 00265 } ; 00266 00267 /// These enumerations specify the demo program to be run when the 00268 /// DEMO command is issued. 00269 enum { 00270 /// Abort the demo that Create is currently performing. 00271 LOBOT_OI_DEMO_ABORT = 255, 00272 00273 /// The Cover demo: Create attempts to cover an entire room using a 00274 /// comination of behaviours such as random bounce, wall following and 00275 /// spiraling. 00276 LOBOT_OI_DEMO_COVER = 0, 00277 00278 /// The Cover and Dock demo: same as Cover except that if the Create 00279 /// sees an infrared signal from the Home Base, it docks and recharges 00280 /// itself. 00281 LOBOT_OI_DEMO_COVER_AND_DOCK, 00282 00283 /// The Spot Cover demo: Create covers an around its starting position 00284 /// by spiraling outward and then inward. 00285 LOBOT_OI_DEMO_SPOT, 00286 00287 /// The Mouse demo: Create locates a wall and then drives along it, 00288 /// traveling around the circumference of the room. 00289 LOBOT_OI_DEMO_MOUSE, 00290 00291 /// The Figure Eight demo: Create continuously drives in a figure 8 00292 /// pattern. 00293 LOBOT_OI_DEMO_FIGURE_EIGHT, 00294 00295 /// The Wimp demo: Create drives forward when pushed from behind; if 00296 /// it hits an obstacle, it drives away from the obstacle. 00297 LOBOT_OI_DEMO_WIMP, 00298 00299 /// The Home demo: Create spins to locate a virtual wall and then 00300 /// drives toward it, stopping when it hits the wall or an obstacle. 00301 LOBOT_OI_DEMO_HOME, 00302 00303 /// The Tag demo: Create spins to locate a virtual wall, then drives 00304 /// toward it. Upon reaching the virtual wall, it spins to find 00305 /// another virtual wall and drives toward it; so on and so forth, 00306 /// continuously bouncing from one virtual wall to the next. 00307 LOBOT_OI_DEMO_TAG, 00308 00309 /// The Pachelbel demo: Create plays the notes of Pachelbel's Canon in 00310 /// sequence when cliff sensors are activated. 00311 LOBOT_OI_DEMO_PACHELBEL, 00312 00313 /// The Banjo demo: Create plays a note for each of its four cliff 00314 /// sensors. 00315 LOBOT_OI_DEMO_BANJO, 00316 } ; 00317 00318 /// Turn radius special cases. 00319 enum { 00320 LOBOT_OI_DRIVE_STRAIGHT = 0x8000, 00321 LOBOT_OI_DRIVE_STRAIGHT2 = 0x7FFF, 00322 LOBOT_OI_TURN_INPLACE_CW = 0xFFFF, 00323 LOBOT_OI_TURN_INPLACE_CCW = 0x0001, 00324 } ; 00325 00326 /// LED bit masks. 00327 enum { 00328 LOBOT_OI_LED_ADVANCE = 0x08, 00329 LOBOT_OI_LED_PLAY = 0x02, 00330 LOBOT_OI_LED_BOTH = 0x0A, 00331 } ; 00332 00333 /// Enumerations for the different sensor packet IDs. 00334 enum { 00335 /// Sensor group zero returns packets 7 through 26. 00336 LOBOT_OI_SENSOR_GROUP_0, 00337 00338 /// Sensor group one returns packets 7 through 16. 00339 LOBOT_OI_SENSOR_GROUP_1, 00340 00341 /// Sensor group two returns packets 17 through 20. 00342 LOBOT_OI_SENSOR_GROUP_2, 00343 00344 /// Sensor group three returns packets 21 through 26. 00345 LOBOT_OI_SENSOR_GROUP_3, 00346 00347 /// Sensor group four returns packets 27 through 34. 00348 LOBOT_OI_SENSOR_GROUP_4, 00349 00350 /// Sensor group five returns packets 35 through 42. 00351 LOBOT_OI_SENSOR_GROUP_5, 00352 00353 /// Sensor group six returns all sensor packets, i.e., 7 through 42. 00354 LOBOT_OI_SENSOR_GROUP_6, 00355 00356 /// Packet 7 is for the state of the bump and wheel drop sensors. A 00357 /// single byte is returned for these sensors. Bits 0 and 1 are for 00358 /// the right and left bump sensors respectively; bits 2, 3 and 4 are 00359 /// for the right, left and caster wheel drops respectively. 00360 /// 00361 /// A value of 1 for a bit means that that particular sensor is on; 00362 /// zero means the sensor is off. 00363 /// 00364 /// DEVNOTE: This file defines constants for the bit masks that can be 00365 /// used to examine this sensor packet's data/value byte. 00366 LOBOT_OI_SENSOR_BUMP_DROP, 00367 00368 /// This packet returns a single byte specifying the state of the wall 00369 /// sensor. A value of 1 means that a wall has been detected; zero 00370 /// means no wall. 00371 LOBOT_OI_SENSOR_WALL, 00372 00373 /// These packets return single bytes for the states of the cliff 00374 /// sensors. One implies a cliff; zero means no cliff. 00375 //@{ 00376 LOBOT_OI_SENSOR_CLIFF_LEFT, 00377 LOBOT_OI_SENSOR_CLIFF_FRONT_LEFT, 00378 LOBOT_OI_SENSOR_CLIFF_FRONT_RIGHT, 00379 LOBOT_OI_SENSOR_CLIFF_RIGHT, 00380 //@} 00381 00382 /// This packet returns a single byte specifying the state of the 00383 /// virtual wall sensor. A value of 1 means that a virtual wall has 00384 /// been detected; zero means no virtual wall. 00385 /// 00386 /// NOTE: The force field around the IR emitter atop the Home Base 00387 /// also trips this sensor. 00388 LOBOT_OI_SENSOR_VIRTUAL_WALL, 00389 00390 /// This packet returns a single data byte specifying the value of the 00391 /// IR byte currently being received by the Create. These bytes can be 00392 /// sent by the Roomba Remote, the Home Base or by other Create robots 00393 /// and/or user-created devices. 00394 /// 00395 /// The value of this sensor is an unsigned byte in the range [0, 255]. 00396 /// 00397 /// DEVNOTE: This file defines symbolic constants for the byte values 00398 /// that can be sent by the Roomba Remote and the Home Base. 00399 LOBOT_OI_SENSOR_INFRARED_BYTE = 17, 00400 00401 /// This packet returns an unsigned byte indicating the state of the 00402 /// Create's Play and Advance buttons. Bit #0 specifies the state of 00403 /// the Play button and bit #2 is for the Advance button. When these 00404 /// bits are 1, the buttons are being pressed; zero means the buttons 00405 /// are not being pressed. 00406 /// 00407 /// DEVNOTE: This file defines symbolic constants that can be used as 00408 /// bit masks to ascertain the states of these two buttons using the 00409 /// data byte returned by this sensor packet. 00410 LOBOT_OI_SENSOR_BUTTONS, 00411 00412 /// This packet returns the distance (in mm) the robot has travelled 00413 /// since the previous query of this sensor. The value is returned as 00414 /// a signed 16-bit integer (high byte first). 00415 /// 00416 /// NOTE: If this value is not polled often enough, it will be capped 00417 /// at its minimum or maximum. Also, if the wheels slip, the actual 00418 /// distance may be different from the one measured by the robot. 00419 LOBOT_OI_SENSOR_DISTANCE, 00420 00421 /// This packet returns the angle (in degrees) that the robot has 00422 /// turned since the previous query of this sensor. The value is 00423 /// returned as a signed 16-bit integer (high byte first). 00424 /// 00425 /// NOTE: If this value is not polled often enough, it will be capped 00426 /// at its minimum or maximum. Also, if the wheels slip, the actual 00427 /// angle may be different from the one measured by the robot. 00428 LOBOT_OI_SENSOR_ANGLE, 00429 00430 /// This packet returns the robot's current charging state. The return 00431 /// value is a single unsigned byte containing a code indicating the 00432 /// state. 00433 /// 00434 /// DEVNOTE: This file defines symbolic constants for the charging 00435 /// state. 00436 LOBOT_OI_SENSOR_CHARGING_STATE, 00437 00438 /// This packet indicates the voltage (in mV) of the robot's battery. 00439 /// It is returned as an unsigned 16-bit number (high byte first). 00440 LOBOT_OI_SENSOR_VOLTAGE, 00441 00442 /// This packet indicates the current (in mA) flowing into or out of 00443 /// the robot's battery. It is returned as a signed 16-bit number 00444 /// (high byte first). Negative values indicate current flowing out 00445 /// of the battery (as during normal operation) and positive values 00446 /// indicate current flowing into the battery (as during charging). 00447 LOBOT_OI_SENSOR_CURRENT, 00448 00449 /// This packet returns a single signed data byte indicating the 00450 /// battery temperature (in degrees Celcius). 00451 LOBOT_OI_SENSOR_BATTERY_TEMP, 00452 00453 /// This packet returns an unsigned 16-bit integer (high byte first) 00454 /// indicating the current charge in the robot's battery (in mAh). The 00455 /// charge value will decrease as the battery is depleted during 00456 /// normal operation and increase when it is being recharged. 00457 LOBOT_OI_SENSOR_BATTERY_CHARGE, 00458 00459 /// This packet returns an unsigned 16-bit integer (high byte first) 00460 /// indicating the estimated charge capacity in the robot's battery 00461 /// (in mAh). 00462 LOBOT_OI_SENSOR_BATTERY_CAPACITY, 00463 00464 /// This packet returns the strength of the wall sensor's signal in an 00465 /// unsigned 16-bit integer (high byte first) whose value can range 00466 /// from 0 to 4095. 00467 LOBOT_OI_SENSOR_WALL_SIGNAL, 00468 00469 /// These packets return the strength of the cliff sensors' signals in 00470 /// unsigned 16-bit integers (high bytes first) whose values are in 00471 /// the range [0, 4095]. 00472 //@{ 00473 LOBOT_OI_SENSOR_CLIFF_LEFT_SIGNAL, 00474 LOBOT_OI_SENSOR_CLIFF_FRONT_LEFT_SIGNAL, 00475 LOBOT_OI_SENSOR_CLIFF_FRONT_RIGHT_SIGNAL, 00476 LOBOT_OI_SENSOR_CLIFF_RIGHT_SIGNAL, 00477 //@} 00478 00479 /// This packet returns via an unsigned byte the availability of 00480 /// charging sources. If bit #0 is set, it means that the robot's 00481 /// internal charger is connected to a power supply; zero means this 00482 /// charging source is absent. If bit #1 is on, then the robot is 00483 /// connected to its Home Base; zero means not on the Home Base. 00484 /// 00485 /// DEVNOTE: This file defines appropriate bit mask constants to test 00486 /// this sensor packet's return value. 00487 LOBOT_OI_SENSOR_CHARGING_SOURCES = 34, 00488 00489 /// This packet returns the current mode (Off, Passive, Safe or Full). 00490 /// The return value is a single unsigned byte. 00491 /// 00492 /// DEVNOTE: This file defines symbolic constants for the 00493 /// above-mentioned states. 00494 LOBOT_OI_SENSOR_MODE, 00495 00496 /// This packet returns the currently selected song via a single 00497 /// unsigned data byte. 00498 LOBOT_OI_SENSOR_SONG_NUMBER, 00499 00500 /// This packet returns one unsigned data byte, a flag indicating 00501 /// whether the robot is currently playing a song or not. 00502 LOBOT_OI_SENSOR_SONG_PLAYING, 00503 00504 /// This packet returns the most recently requested drive command 00505 /// speed parameter via a signed 16-bit integer (high byte first). The 00506 /// return value will lie in the range [-500, 500]. 00507 LOBOT_OI_SENSOR_REQUESTED_SPEED, 00508 00509 /// This packet returns the most recently requested drive command turn 00510 /// radius parameter via a signed 16-bit integer (high byte first). 00511 /// The return value will lie in the range [-2000, 2000]. 00512 LOBOT_OI_SENSOR_REQUESTED_RADIUS, 00513 00514 /// These packets return the most recently requested drive direct 00515 /// command speed parameters via a signed 16-bit integer (high byte 00516 /// first). The return value will lie in the range [-500, 500]. 00517 //@{ 00518 LOBOT_OI_SENSOR_REQUESTED_SPEED_RIGHT, 00519 LOBOT_OI_SENSOR_REQUESTED_SPEED_LEFT, 00520 //@} 00521 } ; 00522 00523 /// Sensor bit masks 00524 enum { 00525 /// Bit masks to test the bump sensors. 00526 //@{ 00527 LOBOT_OI_BUMP_LEFT = 0x02, 00528 LOBOT_OI_BUMP_RIGHT = 0x01, 00529 LOBOT_OI_BUMP_BOTH = 0x03, 00530 LOBOT_OI_BUMP_EITHER = 0x03, 00531 //@} 00532 00533 /// Bit masks to test the wheel drop sensors. 00534 //@{ 00535 LOBOT_OI_WHEEL_DROP_CASTER = 0x10, 00536 LOBOT_OI_WHEEL_DROP_LEFT = 0x08, 00537 LOBOT_OI_WHEEL_DROP_RIGHT = 0x04, 00538 LOBOT_OI_WHEEL_DROP_ALL = 0x1C, 00539 LOBOT_OI_WHEEL_DROP_ANY = 0x1C, 00540 //@} 00541 00542 /// Bit masks to test the states of the Play and Advance buttons. 00543 //@{ 00544 LOBOT_OI_BUTTON_ADVANCE = 0x04, 00545 LOBOT_OI_BUTTON_PLAY = 0x01, 00546 //@} 00547 } ; 00548 00549 /// Enumerations for the infrared bytes sent by the Roomba remote and the 00550 /// Home base. 00551 enum { 00552 LOBOT_OI_REMOTE_LEFT = 129, 00553 LOBOT_OI_REMOTE_FORWARD, 00554 LOBOT_OI_REMOTE_RIGHT, 00555 LOBOT_OI_REMOTE_SPOT, 00556 LOBOT_OI_REMOTE_MAX, 00557 LOBOT_OI_REMOTE_SMALL, 00558 LOBOT_OI_REMOTE_MEDIUM, 00559 LOBOT_OI_REMOTE_LARGE, 00560 LOBOT_OI_REMOTE_CLEAN = LOBOT_OI_REMOTE_LARGE, 00561 LOBOT_OI_REMOTE_PAUSE, 00562 LOBOT_OI_REMOTE_POWER, 00563 LOBOT_OI_REMOTE_ARC_FORWARD_LEFT, 00564 LOBOT_OI_REMOTE_ARC_FORWARD_RIGHT, 00565 LOBOT_OI_REMOTE_DRIVE_STOP, 00566 00567 LOBOT_OI_HOME_BASE_FORCE_FIELD = 242, 00568 LOBOT_OI_HOME_BASE_GREEN_BUOY = 244, 00569 LOBOT_OI_HOME_BASE_GBFF = 246, // green buoy and force field 00570 LOBOT_OI_HOME_BASE_RED_BUOY = 248, 00571 LOBOT_OI_HOME_BASE_RBFF = 250, // red buoy and force field 00572 LOBOT_OI_HOME_BASE_RG_BUOY = 252, // red and green buoys 00573 LOBOT_OI_HOME_BASE_RGBFF = 254, // red and green buoys and force field 00574 } ; 00575 00576 /// Enumerations for the current charging state. 00577 enum { 00578 LOBOT_OI_CHARGING_NOT, 00579 LOBOT_OI_CHARGING_RECONDITIONING, 00580 LOBOT_OI_CHARGING_FULL, 00581 LOBOT_OI_CHARGING_TRICKLE, 00582 LOBOT_OI_CHARGING_WAITING, 00583 LOBOT_OI_CHARGING_FAULT, 00584 } ; 00585 00586 /// Enumerations for the charging sources. 00587 enum { 00588 LOBOT_OI_CHSRC_HOME_BASE = 0x02, 00589 LOBOT_OI_CHSRC_INTERNAL = 0x01, 00590 } ; 00591 00592 /// Enumerations for the robot's operational mode. 00593 enum { 00594 LOBOT_OI_MODE_OFF, 00595 LOBOT_OI_MODE_PASSIVE, 00596 LOBOT_OI_MODE_SAFE, 00597 LOBOT_OI_MODE_FULL, 00598 } ; 00599 00600 /// Enumerations for the number of bytes of sensor data returned for the 00601 /// predefined sensor groups. 00602 enum { 00603 LOBOT_OI_SENSOR_SIZE_GROUP_0 = 26, 00604 LOBOT_OI_SENSOR_SIZE_GROUP_1 = 10, 00605 LOBOT_OI_SENSOR_SIZE_GROUP_2 = 6, 00606 LOBOT_OI_SENSOR_SIZE_GROUP_3 = 10, 00607 LOBOT_OI_SENSOR_SIZE_GROUP_4 = 14, 00608 LOBOT_OI_SENSOR_SIZE_GROUP_5 = 12, 00609 LOBOT_OI_SENSOR_SIZE_GROUP_6 = 52, 00610 } ; 00611 00612 /*---------------------------------------------------------------------*/ 00613 00614 #ifdef __cplusplus 00615 } // end of extern "C" 00616 #endif 00617 00618 #endif