00001 00006 /***************************************************************************** 00007 ** Includes 00008 *****************************************************************************/ 00009 00010 #include <iostream> 00011 #include <kobuki_driver/kobuki.hpp> 00012 00013 class KobukiManager { 00014 public: 00015 KobukiManager() { 00016 kobuki::Parameters parameters; 00017 // change the default device port from /dev/kobuki to /dev/ttyUSB0 00018 parameters.device_port = "/dev/ttyUSB0"; 00019 // Other parameters are typically happy enough as defaults 00020 // namespaces all sigslot connection names under this value, only important if you want to 00021 parameters.sigslots_namespace = "/kobuki"; 00022 // Most people will prefer to do their own velocity smoothing/acceleration limiting. 00023 // If you wish to utilise kobuki's minimal acceleration limiter, set to true 00024 parameters.enable_acceleration_limiter = false; 00025 // If your battery levels are showing significant variance from factory defaults, adjust thresholds. 00026 // This will affect the led on the front of the robot as well as when signals are emitted by the driver. 00027 parameters.battery_capacity = 16.5; 00028 parameters.battery_low = 14.0; 00029 parameters.battery_dangerous = 13.2; 00030 00031 // initialise - it will throw an exception if parameter validation or initialisation fails. 00032 try { 00033 kobuki.init(parameters); 00034 } catch ( ecl::StandardException &e ) { 00035 std::cout << e.what(); 00036 } 00037 } 00038 private: 00039 kobuki::Kobuki kobuki; 00040 }; 00041 00042 int main() { 00043 KobukiManager kobuki_manager; 00044 return 0; 00045 }