#include "config.h"
#include <bitset>
#include <cassert>
#include <sstream>
#include <unistd.h>
#include "irobot-create.hh"

Namespaces | |
| namespace | iRobot |
Defines | |
| #define | INITIALIZE_SENSORS() |
| #define | MAKE_SENSOR_CMD(OP, CMD) |
| Internal macro. | |
| #define | GEN_SENSOR(PACKET, SENSOR, TYPE) |
| #define | CHAR_SENSOR(PACKET, SENSOR) GEN_SENSOR (PACKET, SENSOR, char) |
| #define | UCHAR_SENSOR(PACKET, SENSOR) GEN_SENSOR (PACKET, SENSOR, unsigned char) |
| #define | INT_SENSOR(PACKET, SENSOR) |
| #define | GROUP_SENSOR(PACKET, MIN, MAX) |
| #define | MK_SENSOR_GETTER(TYPE, NAME) |
| #define CHAR_SENSOR | ( | PACKET, | |||
| SENSOR | ) | GEN_SENSOR (PACKET, SENSOR, char) |
| #define GEN_SENSOR | ( | PACKET, | |||
| SENSOR, | |||||
| TYPE | ) |
Value:
case PACKET: \ { \ unsigned char v = 0; \ if (!safeGet (stream, v)) \ return false; \ SENSOR = static_cast<TYPE> (v); \ } \ break
| #define GROUP_SENSOR | ( | PACKET, | |||
| MIN, | |||||
| MAX | ) |
Value:
{ \
case PACKET: \
bool res = true; \
for (SensorPacket sensor = static_cast<SensorPacket> (MIN); \
sensor < static_cast<SensorPacket> (MAX); \
sensor = static_cast<SensorPacket> (sensor + 1)) \
res = res && readSensorPacket (sensor, stream); \
if (!res) \
return false; \
} \
break
| #define INITIALIZE_SENSORS | ( | ) |
| #define INT_SENSOR | ( | PACKET, | |||
| SENSOR | ) |
Value:
case PACKET: \ { \ SENSOR = receiveInt16 (stream); \ } \ break
| #define MAKE_SENSOR_CMD | ( | OP, | |||
| CMD | ) |
Value:
if (currentMode_ < IROBOT_CREATE_PASSIVE) \ throw CommandNotAvailable (); \ if (packets.size () > 255) \ throw InvalidArgument (); \ \ std::stringstream ss; \ for (sensorPackets_t::const_iterator it = packets.begin (); \ it != packets.end (); ++it) \ { \ if (*it < SENSOR_GROUP_0 \ || *it > SENSOR_REQUESTED_LEFT_VELOCITY) \ throw InvalidArgument (); \ const unsigned char p = *it; \ ss << p; \ CMD; \ } \ \ const unsigned char op = (OP); \ const unsigned char size = packets.size (); \ stream_ << op << size << ss.str (); \ stream_.flush ()
| #define MK_SENSOR_GETTER | ( | TYPE, | |||
| NAME | ) |
Value:
TYPE \
Create::NAME () \
{ \
updateSensors (); \
return NAME##_; \
}
| #define UCHAR_SENSOR | ( | PACKET, | |||
| SENSOR | ) | GEN_SENSOR (PACKET, SENSOR, unsigned char) |
1.5.4