The kobuki::Kobuki class is the first port of call for developing your kobuki program. All kobuki configuration and interaction is done via this class. This guide will cover configuration and interaction with the library method api. Interactions via callbacks using sigslots is covered especially in the guide on sigslots.
Kobuki configuration is handled by the kobuki::Parameters class which is passed to the kobuki instance via the kobuki::Kobuki::init() method. Most of the parameters to be configured have sane defaults. The only one that requires frequent configuration is typically the serial device_port. Note that on some systems you can configure a rule (refer to the ftdi serial device guide) for the device port, otherwise you will require one of the usual COM1 or /dev/ttyUSB0 values.
If you compile and run this program, you should hear kobuki's starting up chirp followed immediately by the shutting down chirp.
The kobuki driver runs a background thread which continually retrieves packets from the kobuki, saving the raw data, and additionally doing some processing before updating the current state of the robot.
Raw data can be accessed at any time by one of the following getXXX commands:
The gyro provides both filtered yaw angle as well as unfiltered 3-axis inertial data hence the two calls above.
The following are convenience methods for accessing the current state of the robot
The final function of importance is the kobuki::Kobuki::updateOdometry method. This updates the current odometry state of the robot, fusing encoder and gyro heading data with the previous known state. For deterministic odometry, it is important this method is called each time a new data packet from the kobuki arrives. Refer to the simple control loop example for more information and working code to illustrate.