initialisation.cpp
Go to the documentation of this file.
1 
6 /*****************************************************************************
7 ** Includes
8 *****************************************************************************/
9 
10 #include <iostream>
11 #include <kobuki_driver/kobuki.hpp>
12 #include <ecl/time.hpp>
13 
15 public:
16  KobukiManager() {
17  kobuki::Parameters parameters;
18  // change the default device port from /dev/kobuki to /dev/ttyUSB0
19  parameters.device_port = "/dev/ttyUSB0";
20  // Other parameters are typically happy enough as defaults
21  // namespaces all sigslot connection names under this value, only important if you want to
22  parameters.sigslots_namespace = "/kobuki";
23  // Most people will prefer to do their own velocity smoothing/acceleration limiting.
24  // If you wish to utilise kobuki's minimal acceleration limiter, set to true
25  parameters.enable_acceleration_limiter = false;
26  // If your battery levels are showing significant variance from factory defaults, adjust thresholds.
27  // This will affect the led on the front of the robot as well as when signals are emitted by the driver.
28  parameters.battery_capacity = 16.5;
29  parameters.battery_low = 14.0;
30  parameters.battery_dangerous = 13.2;
31 
32  // initialise - it will throw an exception if parameter validation or initialisation fails.
33  try {
34  kobuki.init(parameters);
35  } catch ( ecl::StandardException &e ) {
36  std::cout << e.what();
37  }
38  }
39 private:
41 };
42 
43 int main() {
44  KobukiManager kobuki_manager;
45  ecl::Sleep()(5);
46  return 0;
47 }
kobuki::Parameters::sigslots_namespace
std::string sigslots_namespace
The first part of a sigslot connection namespace ["/kobuki"].
Definition: parameters.hpp:69
kobuki::Parameters::enable_acceleration_limiter
bool enable_acceleration_limiter
Enable or disable the acceleration limiter [true].
Definition: parameters.hpp:71
kobuki
Definition: command.hpp:31
KobukiManager::kobuki
kobuki::Kobuki kobuki
Definition: initialisation.cpp:42
KobukiManager
Keyboard remote control for our robot core (mobile base).
Definition: initialisation.cpp:14
ecl::StandardException
kobuki::Parameters
Parameter list and validator for the kobuki.
Definition: parameters.hpp:42
kobuki.hpp
Device driver core interface.
kobuki::Kobuki
The core kobuki driver class.
Definition: kobuki.hpp:95
ecl::StandardException::what
const char * what() const
KobukiManager::KobukiManager
KobukiManager()
Default constructor, needs initialisation.
Definition: initialisation.cpp:18
time.hpp
kobuki::Parameters::battery_dangerous
double battery_dangerous
Threshold for battery level in danger of depletion [13.2V].
Definition: parameters.hpp:74
kobuki::Parameters::battery_low
double battery_low
Threshold for battery level warnings [14.0V].
Definition: parameters.hpp:73
kobuki::Parameters::device_port
std::string device_port
The serial device port name [/dev/kobuki].
Definition: parameters.hpp:68
kobuki::Parameters::battery_capacity
double battery_capacity
Capacity voltage of the battery [16.5V].
Definition: parameters.hpp:72
main
int main()
Definition: initialisation.cpp:43


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14