initialisation.cpp
Go to the documentation of this file.
1 
6 /*****************************************************************************
7 ** Includes
8 *****************************************************************************/
9 
10 #include <iostream>
11 #include <xbot_driver/xbot.hpp>
12 #include <ecl/time.hpp>
13 
14 class XbotManager {
15 public:
17  xbot::Parameters parameters;
18  // change the default device port from /dev/xbot to /dev/ttyUSB0
19  parameters.base_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 = "/xbot";
23  // Most people will prefer to do their own velocity smoothing/acceleration limiting.
24  // If you wish to utilise xbot'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  // initialise - it will throw an exception if parameter validation or initialisation fails.
29  try {
30  xbot.init(parameters);
31  } catch ( ecl::StandardException &e ) {
32  std::cout << e.what();
33  }
34  }
35 private:
37 };
38 
39 int main() {
40  XbotManager xbot_manager;
41  ecl::Sleep()(500);
42  return 0;
43 }
std::string base_port
The serial device port name [/dev/xbot].
Definition: parameters.hpp:51
const char * what() const
XbotManager()
Default constructor, needs initialisation.
Parameter list and validator for the xbot.
Definition: parameters.hpp:35
std::string sigslots_namespace
The first part of a sigslot connection namespace ["/xbot"].
Definition: parameters.hpp:53
xbot::Xbot xbot
Device driver core interface.
Standard exception type, provides code location and error string.
Keyboard remote control for our robot core (mobile base).
int main()
Definition: command.hpp:30
bool enable_acceleration_limiter
Enable or disable the acceleration limiter [true].
Definition: parameters.hpp:55
The core xbot driver class.
Definition: xbot.hpp:86


xbot_driver
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:27:37