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 std::cout << std::endl <<
"Press center 'Clean' button to disconnect and end program" << std::endl;
65 uint16_t light_signals[6];
66 bool light_bumpers[6];
67 bool contact_bumpers[2];
94 std::cout <<
"[ " << light_signals[0] <<
" , " 95 << light_signals[1] <<
" , " 96 << light_signals[2] <<
" , " 97 << light_signals[3] <<
" , " 98 << light_signals[4] <<
" , " 100 <<
" ]" << std::endl;
101 std::cout <<
"[ " << light_bumpers[0] <<
" , " 102 << light_bumpers[1] <<
" , " 103 << light_bumpers[2] <<
" , " 104 << light_bumpers[3] <<
" , " 105 << light_bumpers[4] <<
" , " 107 <<
" ]" << std::endl;
108 std::cout <<
"[ " << contact_bumpers[0] <<
" , " 109 << contact_bumpers[1]
110 <<
" ]" << std::endl;
111 std::cout << std::endl;
116 std::cout << std::endl;
124 std::cout <<
"Bye!" << 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
bool isCleanButtonPressed() const
Get state of 'clean' button ('play' button on Create 1).
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.
void disconnect()
Disconnect from serial.
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.