Kobuki 1.0.0
C++ API for the Kobuki research robot
Loading...
Searching...
No Matches
kobuki::Kobuki Class Reference

The core kobuki driver class. More...

#include <kobuki.hpp>

Public Member Functions

 ~Kobuki ()
 
void init (Parameters &parameters)
 
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.
 

Detailed Description

The core kobuki driver class.

This connects to the outside world via sigslots and get accessors.

Constructor & Destructor Documentation

◆ ~Kobuki()

kobuki::Kobuki::~Kobuki ( )

Shutdown the driver - make sure we wait for the thread to finish.

Member Function Documentation

◆ disable()

bool kobuki::Kobuki::disable ( )

Disable power to the motors.

◆ enable()

bool kobuki::Kobuki::enable ( )

Enable power to the motors.

◆ isAlive()

bool kobuki::Kobuki::isAlive ( ) const
inline

Whether the connection to the robot is alive and currently streaming.

◆ isEnabled()

bool kobuki::Kobuki::isEnabled ( ) const
inline

Whether the motor power is enabled or disabled.

◆ isShutdown()

bool kobuki::Kobuki::isShutdown ( ) const
inline

Whether the worker thread is alive or not.

◆ lockDataAccess()

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.

◆ printSigSlotConnections()

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).

◆ shutdown()

void kobuki::Kobuki::shutdown ( )
inline

Gently terminate the worker thread.

◆ spin()

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.

◆ unlockDataAccess()

void kobuki::Kobuki::unlockDataAccess ( )

Unlock a previously locked data access privilege.

See also
lockDataAccess()

◆ updateOdometry()

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.

Parameters
pose_update: return the pose updates in this variable.
pose_update_rates: return the pose update rates in this variable.

The documentation for this class was generated from the following files: