![]() |
Kobuki 1.0.0
C++ API for the Kobuki research robot
|
The core kobuki driver class. More...
#include <kobuki.hpp>
Public Member Functions | |
~Kobuki () | |
void | init (Parameters ¶meters) |
bool | isAlive () const |
bool | isShutdown () const |
bool | isEnabled () const |
bool | enable () |
bool | disable () |
void | shutdown () |
void | spin () |
Performs a scan looking for incoming data packets. | |
void | fixPayload (ecl::PushAndPop< unsigned char > &byteStream) |
void | lockDataAccess () |
void | unlockDataAccess () |
ecl::Angle< double > | getHeading () const |
double | getAngularVelocity () const |
VersionInfo | versionInfo () const |
Battery | batteryStatus () const |
CoreSensors::Data | getCoreSensorData () const |
DockIR::Data | getDockIRData () const |
Cliff::Data | getCliffData () const |
Current::Data | getCurrentData () const |
Inertia::Data | getInertiaData () const |
GpInput::Data | getGpInputData () const |
ThreeAxisGyro::Data | getRawInertiaData () const |
ControllerInfo::Data | getControllerInfoData () const |
void | getWheelJointStates (double &wheel_left_angle, double &wheel_left_angle_rate, double &wheel_right_angle, double &wheel_right_angle_rate) |
void | updateOdometry (ecl::linear_algebra::Vector3d &pose_update, ecl::linear_algebra::Vector3d &pose_update_rates) |
Use the current sensor data (encoders and gyro) to calculate an update for the odometry. | |
void | resetOdometry () |
void | setBaseControl (const double &linear_velocity, const double &angular_velocity) |
void | setLed (const enum LedNumber &number, const enum LedColour &colour) |
void | setDigitalOutput (const DigitalOutput &digital_output) |
void | setExternalPower (const DigitalOutput &digital_output) |
void | playSoundSequence (const enum SoundSequences &number) |
bool | setControllerGain (const unsigned char &type, const unsigned int &p_gain, const unsigned int &i_gain, const unsigned int &d_gain) |
bool | getControllerGain () |
void | printSigSlotConnections () const |
Print a list of all relevant sigslot connections. | |
The core kobuki driver class.
This connects to the outside world via sigslots and get accessors.
kobuki::Kobuki::~Kobuki | ( | ) |
Shutdown the driver - make sure we wait for the thread to finish.
bool kobuki::Kobuki::disable | ( | ) |
Disable power to the motors.
bool kobuki::Kobuki::enable | ( | ) |
Enable power to the motors.
|
inline |
Whether the connection to the robot is alive and currently streaming.
|
inline |
Whether the motor power is enabled or disabled.
|
inline |
Whether the worker thread is alive or not.
void kobuki::Kobuki::lockDataAccess | ( | ) |
Usually you should call the getXXX functions from within slot callbacks connected to this driver's signals. This ensures that data is not overwritten inbetween getXXX calls as it all happens in the serial device's reading thread (aye, convoluted - apologies for the multiple robot and multiple developer adhoc hacking over 4-5 years for hasty demos on pre-kobuki robots. This has generated such wonderful spaghetti ;).
If instead you just want to poll kobuki, then you should lock and unlock the data access around any getXXX calls.
void kobuki::Kobuki::printSigSlotConnections | ( | ) | const |
Print a list of all relevant sigslot connections.
This includes both the kobuki driver signals as well as externally connected slots. Useful for when you need to check if any of your connections are dangling (often happens when you typo the name of the sigslots connection).
|
inline |
Gently terminate the worker thread.
void kobuki::Kobuki::spin | ( | ) |
Performs a scan looking for incoming data packets.
Sits on the device waiting for incoming and then parses it, and signals that an update has occured.
Or, if in simulation, just loopsback the motor devices.
void kobuki::Kobuki::unlockDataAccess | ( | ) |
Unlock a previously locked data access privilege.
void kobuki::Kobuki::updateOdometry | ( | ecl::linear_algebra::Vector3d & | pose_update, |
ecl::linear_algebra::Vector3d & | pose_update_rates | ||
) |
Use the current sensor data (encoders and gyro) to calculate an update for the odometry.
This fuses current sensor data with the last updated odometry state to produce the new odometry state. This will be usually done in the slot callback to the stream_data signal.
It is important that this is called every time a data packet is received from the robot.
pose_update | : return the pose updates in this variable. |
pose_update_rates | : return the pose update rates in this variable. |