35 int main(
int argc,
char** argv) {
38 std::string port =
"/dev/ttyUSB0";
40 if (argc > 1 && std::string(argv[1]) ==
"create1") {
43 std::cout <<
"Running driver for Create 1" << std::endl;
46 std::cout <<
"Running driver for Create 2" << std::endl;
54 std::cout <<
"Connected to robot" << std::endl;
56 std::cout <<
"Failed to connect to robot on port " << port.c_str() << std::endl;
63 uint16_t light_signals[6] = {0, 0, 0, 0, 0, 0};
64 bool light_bumpers[6] = {
false,
false,
false,
false,
false,
false};
65 bool contact_bumpers[2] = {
false,
false};
92 std::cout <<
"[ " << light_signals[0] <<
" , " 93 << light_signals[1] <<
" , " 94 << light_signals[2] <<
" , " 95 << light_signals[3] <<
" , " 96 << light_signals[4] <<
" , " 99 std::cout <<
"[ " << light_bumpers[0] <<
" , " 100 << light_bumpers[1] <<
" , " 101 << light_bumpers[2] <<
" , " 102 << light_bumpers[3] <<
" , " 103 << light_bumpers[4] <<
" , " 105 <<
" ]" << std::endl;
106 std::cout <<
"[ " << contact_bumpers[0] <<
" , " 107 << contact_bumpers[1]
108 <<
" ]" << std::endl;
109 std::cout << std::endl;
bool isLightBumperFrontLeft() const
static RobotModel CREATE_1
Compatible with Create 1 or Roomba 500 series.
bool isLeftBumper() const
uint16_t getLightSignalFrontLeft() const
Get the signal strength from the front-left light sensor.
bool isLightBumperCenterRight() const
bool isLightBumperFrontRight() const
int main(int argc, char **argv)
uint16_t getLightSignalCenterLeft() const
Get the signal strength from the center-left light sensor.
bool isLightBumperLeft() const
uint16_t getLightSignalLeft() const
Get the signal strength from the left light sensor.
bool isRightBumper() const
uint16_t getLightSignalCenterRight() const
Get the signal strength from the center-right light sensor.
uint16_t getLightSignalRight() const
Get the signal strength from the right light sensor.
bool connect(const std::string &port, const int &baud)
Make a serial connection to Create.
static RobotModel CREATE_2
Compatible with Create 2 or Roomba 600 series and greater.
bool setMode(const create::CreateMode &mode)
Change Create mode.
bool isLightBumperRight() const
bool isLightBumperCenterLeft() const
uint16_t getLightSignalFrontRight() const
Get the signal strength from the front-right light sensor.