8 std::cout << ss->str() << std::endl << std::endl;
12 std::cout <<
"!!!!!!!!!!!!WARNING!!!!!!!!!!!!" << std::endl;
13 std::cout <<
"This example moves the segway!!" << std::endl;
14 std::cout <<
"(If you continue, ctrl-c quits)" << std::endl;
15 std::cout <<
"Do you want to continue? [No/yes] ";
17 std::getline(std::cin, response);
18 std::transform(response.begin(), response.end(),
19 response.begin(), ::tolower);
20 if (response != std::string(
"yes") and response != std::string(
"y")) {
21 std::cout <<
"Aborting." << std::endl;
30 switch (config_type) {
42 std::cout <<
"Invalid interface type provided." 54 }
catch (std::exception &e) {
55 std::cerr <<
"Error: " << e.what() << std::endl;
61 std::cout <<
"Usage: " << std::endl;
62 std::cout <<
" segwayrmp_example usb <serial_number | description | " 63 "index> <\"00000056\" | \"Robotic Mobile Platform\" | 0>" 65 std::cout <<
" or" << std::endl;
66 std::cout <<
" segwayrmp_example serial <serial port>" << std::endl;
67 std::cout <<
"Examples:" << std::endl;
68 std::cout <<
" segwayrmp_example usb index 0" << std::endl;
69 std::cout <<
" segwayrmp_example usb serial_number \"00000056\"" 71 std::cout <<
" segwayrmp_example serial /dev/ttyUSB0" << std::endl;
72 std::cout <<
" segwayrmp_example serial COM0" << std::endl;
75 int main(
int argc,
char *argv[]) {
80 if (std::strcmp(argv[1],
"serial") == 0) {
86 }
else if (std::strcmp(argv[1],
"usb") == 0) {
92 if (std::strcmp(argv[2],
"serial_number") == 0) {
94 }
else if (std::strcmp(argv[2],
"description") == 0) {
96 }
else if (std::strcmp(argv[2],
"index") == 0) {
int main(int argc, char *argv[])
void configureUSBByIndex(int device_index, int baudrate=460800)
int run_segway(segwayrmp::InterfaceType interface_type, std::string configuration, int config_type=0)
boost::shared_ptr< SegwayStatus > Ptr
void connect(bool reset_integrators=true)
void setStatusCallback(SegwayStatusCallback callback)
void configureSerial(std::string port, int baudrate=460800)
void move(float linear_velocity, float angular_velocity)
void configureUSBByDescription(std::string description, int baudrate=460800)
void configureUSBBySerial(std::string serial_number, int baudrate=460800)
void setOperationalMode(OperationalMode operational_mode)
void handleSegwayStatus(segwayrmp::SegwayStatus::Ptr &ss)