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;
71 std::cout <<
"\rTotal packets: " << total_packets <<
" Corrupt packets: " << num_corrupt_packets;
76 std::cout << std::endl;
84 std::cout <<
"Bye!" << std::endl;
uint64_t getTotalPackets() const
Get the total number of serial packets received (including corrupt packets) since first connecting to...
static RobotModel CREATE_1
Compatible with Create 1 or Roomba 500 series.
uint64_t getNumCorruptPackets() const
Get the number of corrupt serial packets since first connecting to Create. This value is ideally zero...
bool isCleanButtonPressed() const
Get state of 'clean' button ('play' button on Create 1).
int main(int argc, char **argv)
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.