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


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Thu Jun 6 2019 20:24:37