The core kobuki driver class. More...
#include <kobuki.hpp>
Public Member Functions | |
Battery | batteryStatus () const |
bool | disable () |
bool | enable () |
void | fixPayload (ecl::PushAndPop< unsigned char > &byteStream) |
double | getAngularVelocity () const |
Cliff::Data | getCliffData () const |
bool | getControllerGain () |
ControllerInfo::Data | getControllerInfoData () const |
CoreSensors::Data | getCoreSensorData () const |
Current::Data | getCurrentData () const |
DockIR::Data | getDockIRData () const |
GpInput::Data | getGpInputData () const |
ecl::Angle< double > | getHeading () const |
Inertia::Data | getInertiaData () const |
ThreeAxisGyro::Data | getRawInertiaData () const |
void | getWheelJointStates (double &wheel_left_angle, double &wheel_left_angle_rate, double &wheel_right_angle, double &wheel_right_angle_rate) |
void | init (Parameters ¶meters) |
bool | isAlive () const |
bool | isEnabled () const |
bool | isShutdown () const |
Kobuki () | |
void | lockDataAccess () |
void | playSoundSequence (const enum SoundSequences &number) |
void | printSigSlotConnections () const |
Print a list of all relevant sigslot connections. More... | |
void | resetOdometry () |
void | setBaseControl (const double &linear_velocity, const double &angular_velocity) |
bool | setControllerGain (const unsigned char &type, const unsigned int &p_gain, const unsigned int &i_gain, const unsigned int &d_gain) |
void | setDigitalOutput (const DigitalOutput &digital_output) |
void | setExternalPower (const DigitalOutput &digital_output) |
void | setLed (const enum LedNumber &number, const enum LedColour &colour) |
void | shutdown () |
void | spin () |
Performs a scan looking for incoming data packets. More... | |
void | unlockDataAccess () |
void | updateOdometry (ecl::LegacyPose2D< double > &pose_update, ecl::linear_algebra::Vector3d &pose_update_rates) |
Use the current sensor data (encoders and gyro) to calculate an update for the odometry. More... | |
VersionInfo | versionInfo () const |
~Kobuki () | |
Private Member Functions | |
std::vector< std::string > | log (std::string msg) |
std::vector< std::string > | log (std::string level, std::string msg) |
std::vector< std::string > | log (std::string level, std::string name, std::string msg) |
void | sendBaseControlCommand () |
void | sendCommand (Command command) |
Send the prepared command to the serial port. More... | |
The core kobuki driver class.
This connects to the outside world via sigslots and get accessors.
Definition at line 87 of file kobuki.hpp.
kobuki::Kobuki::Kobuki | ( | ) |
Definition at line 51 of file kobuki.cpp.
kobuki::Kobuki::~Kobuki | ( | ) |
Shutdown the driver - make sure we wait for the thread to finish.
Definition at line 66 of file kobuki.cpp.
|
inline |
Definition at line 124 of file kobuki.hpp.
bool kobuki::Kobuki::disable | ( | ) |
Disable power to the motors.
Definition at line 602 of file kobuki.cpp.
bool kobuki::Kobuki::enable | ( | ) |
Enable power to the motors.
Definition at line 596 of file kobuki.cpp.
void kobuki::Kobuki::fixPayload | ( | ecl::PushAndPop< unsigned char > & | byteStream | ) |
Definition at line 387 of file kobuki.cpp.
double kobuki::Kobuki::getAngularVelocity | ( | ) | const |
Definition at line 434 of file kobuki.cpp.
|
inline |
Definition at line 133 of file kobuki.hpp.
bool kobuki::Kobuki::getControllerGain | ( | ) |
Definition at line 517 of file kobuki.cpp.
|
inline |
Definition at line 138 of file kobuki.hpp.
|
inline |
Definition at line 131 of file kobuki.hpp.
|
inline |
Definition at line 134 of file kobuki.hpp.
|
inline |
Definition at line 132 of file kobuki.hpp.
|
inline |
Definition at line 136 of file kobuki.hpp.
ecl::Angle< double > kobuki::Kobuki::getHeading | ( | ) | const |
Definition at line 426 of file kobuki.cpp.
|
inline |
Definition at line 135 of file kobuki.hpp.
|
inline |
Definition at line 137 of file kobuki.hpp.
void kobuki::Kobuki::getWheelJointStates | ( | double & | wheel_left_angle, |
double & | wheel_left_angle_rate, | ||
double & | wheel_right_angle, | ||
double & | wheel_right_angle_rate | ||
) |
Definition at line 452 of file kobuki.cpp.
void kobuki::Kobuki::init | ( | Parameters & | parameters | ) |
Definition at line 74 of file kobuki.cpp.
|
inline |
Whether the connection to the robot is alive and currently streaming.
Definition at line 97 of file kobuki.hpp.
|
inline |
Whether the motor power is enabled or disabled.
Definition at line 99 of file kobuki.hpp.
|
inline |
Whether the worker thread is alive or not.
Definition at line 98 of file kobuki.hpp.
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.
Definition at line 156 of file kobuki.cpp.
|
inlineprivate |
Definition at line 244 of file kobuki.hpp.
|
inlineprivate |
Definition at line 245 of file kobuki.hpp.
|
inlineprivate |
Definition at line 246 of file kobuki.hpp.
void kobuki::Kobuki::playSoundSequence | ( | const enum SoundSequences & | number | ) |
Definition at line 497 of file kobuki.cpp.
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).
Definition at line 618 of file kobuki.cpp.
void kobuki::Kobuki::resetOdometry | ( | ) |
Definition at line 444 of file kobuki.cpp.
|
private |
Definition at line 536 of file kobuki.cpp.
|
private |
Send the prepared command to the serial port.
Need to be a bit careful here, because we have no control over how the user is calling this - they may be calling from different threads (this is so for kobuki_node), so we mutex protect it here rather than relying on the user to do so above.
command | : prepared command template (see Command's static member functions). |
Definition at line 566 of file kobuki.cpp.
void kobuki::Kobuki::setBaseControl | ( | const double & | linear_velocity, |
const double & | angular_velocity | ||
) |
Definition at line 531 of file kobuki.cpp.
bool kobuki::Kobuki::setControllerGain | ( | const unsigned char & | type, |
const unsigned int & | p_gain, | ||
const unsigned int & | i_gain, | ||
const unsigned int & | d_gain | ||
) |
Definition at line 502 of file kobuki.cpp.
void kobuki::Kobuki::setDigitalOutput | ( | const DigitalOutput & | digital_output | ) |
Definition at line 484 of file kobuki.cpp.
void kobuki::Kobuki::setExternalPower | ( | const DigitalOutput & | digital_output | ) |
Definition at line 488 of file kobuki.cpp.
Definition at line 479 of file kobuki.cpp.
|
inline |
Gently terminate the worker thread.
Definition at line 102 of file kobuki.hpp.
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.
Definition at line 177 of file kobuki.cpp.
void kobuki::Kobuki::unlockDataAccess | ( | ) |
Unlock a previously locked data access privilege.
Definition at line 164 of file kobuki.cpp.
void kobuki::Kobuki::updateOdometry | ( | ecl::LegacyPose2D< double > & | 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. |
Definition at line 469 of file kobuki.cpp.
|
inline |
Definition at line 123 of file kobuki.hpp.
|
private |
Definition at line 197 of file kobuki.hpp.
|
private |
Definition at line 205 of file kobuki.hpp.
|
private |
Definition at line 233 of file kobuki.hpp.
|
private |
Definition at line 227 of file kobuki.hpp.
|
private |
Definition at line 212 of file kobuki.hpp.
|
private |
Definition at line 220 of file kobuki.hpp.
|
private |
Definition at line 202 of file kobuki.hpp.
|
private |
Definition at line 206 of file kobuki.hpp.
|
private |
Definition at line 216 of file kobuki.hpp.
|
private |
Definition at line 231 of file kobuki.hpp.
|
private |
Definition at line 180 of file kobuki.hpp.
|
private |
Definition at line 204 of file kobuki.hpp.
|
private |
Definition at line 239 of file kobuki.hpp.
|
private |
Definition at line 209 of file kobuki.hpp.
|
private |
Definition at line 207 of file kobuki.hpp.
|
private |
Definition at line 208 of file kobuki.hpp.
|
private |
Definition at line 186 of file kobuki.hpp.
|
private |
Definition at line 203 of file kobuki.hpp.
|
private |
Definition at line 217 of file kobuki.hpp.
|
private |
Definition at line 192 of file kobuki.hpp.
|
private |
Definition at line 181 of file kobuki.hpp.
|
private |
Definition at line 232 of file kobuki.hpp.
|
private |
Definition at line 215 of file kobuki.hpp.
|
private |
Definition at line 191 of file kobuki.hpp.
|
private |
Definition at line 214 of file kobuki.hpp.
|
private |
Definition at line 175 of file kobuki.hpp.
|
private |
Definition at line 257 of file kobuki.hpp.
|
private |
Definition at line 259 of file kobuki.hpp.
|
private |
Definition at line 259 of file kobuki.hpp.
|
private |
Definition at line 259 of file kobuki.hpp.
|
private |
Definition at line 260 of file kobuki.hpp.
|
private |
Definition at line 263 of file kobuki.hpp.
|
private |
Definition at line 261 of file kobuki.hpp.
|
private |
Definition at line 262 of file kobuki.hpp.
|
private |
Definition at line 257 of file kobuki.hpp.
|
private |
Definition at line 258 of file kobuki.hpp.
|
private |
Definition at line 259 of file kobuki.hpp.
|
private |
Definition at line 174 of file kobuki.hpp.
|
private |
Definition at line 211 of file kobuki.hpp.
|
private |
Definition at line 210 of file kobuki.hpp.
|
private |
Definition at line 234 of file kobuki.hpp.
|
private |
Definition at line 219 of file kobuki.hpp.