types.h
Go to the documentation of this file.
00001 
00032 #ifndef CREATE_TYPES_H
00033 #define CREATE_TYPES_H
00034 
00035 #include <vector>
00036 #include <stdint.h>
00037 #include <string>
00038 #include <stdexcept>
00039 
00040 namespace create {
00041   enum ProtocolVersion {
00042     V_1 = 1,
00043     V_2 = 2,
00044     V_3 = 4,
00045     V_ALL = 0xFFFFFFFF
00046   };
00047 
00048   class RobotModel {
00049     public:
00050       bool operator==(RobotModel& other) const;
00051       operator uint32_t() const;
00052 
00053       uint32_t getId() const;
00054       ProtocolVersion getVersion() const;
00055       float getAxleLength() const;
00056       unsigned int getBaud() const;
00057       float getMaxVelocity() const;
00058       float getWheelDiameter() const;
00059 
00063       static RobotModel ROOMBA_400;
00064 
00068       static RobotModel CREATE_1;
00069 
00073       static RobotModel CREATE_2;
00074 
00075     private:
00076       uint32_t id;
00077       ProtocolVersion version;
00078       float axleLength;
00079       unsigned int baud;
00080       float maxVelocity;
00081       float wheelDiameter;
00082 
00083       RobotModel(const ProtocolVersion version, const float axleLength, const unsigned int baud, const float maxVelocity = 0.5, const float wheelDiameter = 0.078);
00084       static uint32_t nextId;
00085   };
00086 
00087   enum SensorPacketID {
00088     ID_GROUP_0 = 0,
00089     ID_GROUP_1 = 1,
00090     ID_GROUP_2 = 2,
00091     ID_GROUP_3 = 3,
00092     ID_GROUP_4 = 4,
00093     ID_GROUP_5 = 5,
00094     ID_GROUP_6 = 6,
00095     ID_GROUP_100 = 100,
00096     ID_GROUP_101 = 101,
00097     ID_GROUP_106 = 106,
00098     ID_GROUP_107 = 107,
00099     ID_BUMP_WHEELDROP = 7,
00100     ID_WALL = 8,
00101     ID_CLIFF_LEFT = 9,
00102     ID_CLIFF_FRONT_LEFT = 10,
00103     ID_CLIFF_FRONT_RIGHT = 11,
00104     ID_CLIFF_RIGHT = 12,
00105     ID_VIRTUAL_WALL = 13,
00106     ID_OVERCURRENTS = 14,
00107     ID_DIRT_DETECT_LEFT = 15,
00108     ID_DIRT_DETECT_RIGHT = 16,
00109     ID_IR_OMNI = 17,
00110     ID_IR_LEFT = 52,
00111     ID_IR_RIGHT = 53,
00112     ID_BUTTONS = 18,
00113     ID_DISTANCE = 19,
00114     ID_ANGLE = 20,
00115     ID_CHARGE_STATE = 21,
00116     ID_VOLTAGE = 22,
00117     ID_CURRENT = 23,
00118     ID_TEMP = 24,
00119     ID_CHARGE = 25,
00120     ID_CAPACITY = 26,
00121     ID_WALL_SIGNAL = 27,
00122     ID_CLIFF_LEFT_SIGNAL = 28,
00123     ID_CLIFF_FRONT_LEFT_SIGNAL = 29,
00124     ID_CLIFF_FRONT_RIGHT_SIGNAL = 30,
00125     ID_CLIFF_RIGHT_SIGNAL = 31,
00126     ID_CARGO_BAY_DIGITAL_INPUTS = 32,
00127     ID_CARGO_BAY_ANALOG_SIGNAL = 33,
00128     ID_CHARGE_SOURCE = 34,
00129     ID_OI_MODE = 35,
00130     ID_SONG_NUM = 36,
00131     ID_PLAYING = 37,
00132     ID_NUM_STREAM_PACKETS = 38,
00133     ID_VEL = 39,
00134     ID_RADIUS = 40,
00135     ID_RIGHT_VEL = 41,
00136     ID_LEFT_VEL = 42,
00137     ID_LEFT_ENC = 43,
00138     ID_RIGHT_ENC = 44,
00139     ID_LIGHT = 45,
00140     ID_LIGHT_LEFT = 46,
00141     ID_LIGHT_FRONT_LEFT = 47,
00142     ID_LIGHT_CENTER_LEFT = 48,
00143     ID_LIGHT_CENTER_RIGHT = 49,
00144     ID_LIGHT_FRONT_RIGHT = 50,
00145     ID_LIGHT_RIGHT = 51,
00146     ID_LEFT_MOTOR_CURRENT = 54,
00147     ID_RIGHT_MOTOR_CURRENT = 55,
00148     ID_MAIN_BRUSH_CURRENT = 56,
00149     ID_SIDE_BRUSH_CURRENT = 57,
00150     ID_STASIS = 58,
00151     ID_NUM = 52
00152   };
00153 
00154   enum Opcode {
00155     OC_START = 128,
00156     OC_RESET = 7,
00157     OC_STOP = 173,
00158     OC_BAUD = 129,
00159     OC_CONTROL = 130,
00160     OC_SAFE = 131,
00161     OC_FULL = 132,
00162     OC_CLEAN = 135,
00163     OC_MAX = 136,
00164     OC_SPOT = 134,
00165     OC_DOCK = 143,
00166     OC_POWER = 133,
00167     OC_SCHEDULE = 167,
00168     OC_DATE = 168,
00169     OC_DRIVE = 137,
00170     OC_DRIVE_DIRECT = 145,
00171     OC_DRIVE_PWM = 146,
00172     OC_MOTORS = 138,
00173     OC_MOTORS_PWM = 144,
00174     OC_LEDS = 139,
00175     OC_SCHEDULING_LEDS = 162,
00176     OC_DIGIT_LEDS_RAW = 163,
00177     OC_BUTTONS = 165,
00178     OC_DIGIT_LEDS_ASCII = 164,
00179     OC_SONG = 140,
00180     OC_PLAY = 141,
00181     OC_SENSORS= 142,
00182     OC_QUERY_LIST=149,
00183     OC_STREAM = 148,
00184     OC_TOGGLE_STREAM = 150,
00185   };
00186 
00187   enum BAUDCODE {
00188     BAUD_300 = 0,
00189     BAUD_600 = 1,
00190     BAUD_1200 = 2,
00191     BAUD_2400 = 3,
00192     BAUD_4800 = 4,
00193     BAUD_9600 = 5,
00194     BAUD_14400 = 6,
00195     BAUD_19200 = 7,
00196     BAUD_28800 = 8,
00197     BAUD_38400 = 9,
00198     BAUD_57600 = 10,
00199     BAUD_115200 = 11
00200   };
00201 
00202   enum CreateMode {
00203     MODE_OFF = 0,
00204     MODE_PASSIVE = 1,
00205     MODE_SAFE = 2,
00206     MODE_FULL = 3,
00207     MODE_UNAVAILABLE = -1
00208   };
00209 
00210   enum CleanMode {
00211     CLEAN_DEFAULT = OC_CLEAN,
00212     CLEAN_MAX = OC_MAX,
00213     CLEAN_SPOT = OC_SPOT
00214   };
00215 
00216   enum ChargingState {
00217     CHARGE_NONE = 0,
00218     CHARGE_RECONDITION = 1,
00219     CHARGE_FULL = 2,
00220     CHARGE_TRICKLE = 3,
00221     CHARGE_WAITING = 4,
00222     CHARGE_FAULT = 5
00223   };
00224 
00225   enum DayOfWeek {
00226     SUN = 0,
00227     MON = 1,
00228     TUE = 2,
00229     WED = 3,
00230     THU = 4,
00231     FRI = 5,
00232     SAT = 6
00233   };
00234 
00235   enum IRChars {
00236     IR_CHAR_NONE = 0,
00237     IR_CHAR_LEFT = 129,
00238     IR_CHAR_FORWARD = 130,
00239     IR_CHAR_RIGHT = 131,
00240     IR_CHAR_SPOT = 132,
00241     IR_CHAR_MAX = 133,
00242     IR_CHAR_SMALL = 134,
00243     IR_CHAR_MEDIUM = 135,
00244     IR_CHAR_LARGE = 136,
00245     IR_CHAR_CLEAN = 136,
00246     IR_CHAR_PAUSE = 137,
00247     IR_CHAR_POWER = 138,
00248     IR_CHAR_ARC_LEFT = 139,
00249     IR_CHAR_ARC_RIGHT = 140,
00250     IR_CHAR_STOP = 141,
00251     IR_CHAR_DOWNLOAD = 142,
00252     IR_CHAR_SEEK_DOCK = 143,
00253     IR_CHAR_DOCK_RESERVED = 240,
00254     IR_CHAR_RED_BUOY = 248,
00255     IR_CHAR_GREEN_BUOY = 244,
00256     IR_CHAR_FORCE_FIELD = 242,
00257     IR_CHAR_RED_GREEN_BUOY = 252,
00258     IR_CHAR_RED_FORCE_FIELD = 250,
00259     IR_CHAR_GREEN_FORCE_FIELD = 246,
00260     IR_CHAR_RED_GREEN_FORCE_FIELD = 254,
00261     IR_CHAR_600_DOCK_RESERVED = 160,
00262     IR_CHAR_600_FORCE_FIELD = 161,
00263     IR_CHAR_600_GREEN_BUOY = 164,
00264     IR_CHAR_600_GREEN_FORCE_FIELD = 165,
00265     IR_CHAR_600_RED_BUOY = 168,
00266     IR_CHAR_600_RED_FORCE_FIELD = 169,
00267     IR_CHAR_600_RED_GREEN_BUOY = 172,
00268     IR_CHAR_600_RED_GREEN_FORCE_FIELD = 173,
00269     IR_CHAR_VIRTUAL_WALL = 162
00270   };
00271 
00275   struct Pose {
00276     float x;
00277     float y;
00278     float yaw;
00279 
00283     std::vector<float> covariance;
00284   };
00285 
00286   typedef Pose Vel;
00287 } // namespace create
00288 
00289 #endif // CREATE_TYPES_H


libcreate
Author(s): Jacob Perron
autogenerated on Thu Jun 6 2019 21:02:06