The core xbot driver class. More...
#include <xbot.hpp>
Public Member Functions | |
void | base_fixPayload (ecl::PushAndPop< unsigned char > &byteStream) |
bool | base_isAlive () const |
void | base_lockDataAccess () |
void | base_spin () |
Performs a scan looking for incoming data packets. More... | |
void | base_unlockDataAccess () |
bool | disable () |
bool | enable () |
double | getAngularVelocity () const |
CoreSensors::Data | getCoreSensorData () const |
int | getDebugSensors () const |
Sensors::Data | getExtraSensorsData () const |
double | getHeading () const |
unsigned char | getPitchPlatformDegree () const |
bool | getPowerState () |
bool | getStopButtonState () const |
void | getWheelJointStates (float &wheel_left_angle, float &wheel_left_angle_rate, float &wheel_right_angle, float &wheel_right_angle_rate) |
unsigned char | getYawPlatformDegree () const |
void | init (Parameters ¶meters) throw (ecl::StandardException) |
bool | is_base_connected () const |
bool | is_sensor_connected () const |
bool | isEnabled () const |
bool | isShutdown () const |
void | resetOdometry () |
void | resetXbot () |
void | resetXbotState () |
void | sensor_fixPayload (ecl::PushAndPop< unsigned char > &byteStream) |
bool | sensor_isAlive () const |
void | sensor_lockDataAccess () |
void | sensor_spin () |
void | sensor_unlockDataAccess () |
void | setBaseControl (const float &linear_velocity, const float &angular_velocity) |
void | setLedControl (const char &led) |
void | setLiftControl (const unsigned char &height_percent) |
void | setPitchPlatformControl (const int &pitch_degree) |
void | setPowerControl (const bool &power) |
void | setSoundEnableControl (const bool &sound) |
void | setYawPlatformControl (const int &yaw_degree) |
void | shutdown () |
void | updateOdometry (ecl::Pose2D< 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... | |
Xbot () | |
~Xbot () | |
Private Member Functions | |
void | sendBaseControlCommand () |
void | sendCommand (Command command) |
Send the prepared command to the serial port. More... | |
The core xbot driver class.
This connects to the outside world via sigslots and get accessors.
xbot::Xbot::~Xbot | ( | ) |
void xbot::Xbot::base_fixPayload | ( | ecl::PushAndPop< unsigned char > & | byteStream | ) |
|
inline |
void xbot::Xbot::base_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-xbot robots. This has generated such wonderful spaghetti ;).
If instead you just want to poll xbot, then you should lock and unlock the data access around any getXXX calls.
void xbot::Xbot::base_spin | ( | ) |
void xbot::Xbot::base_unlockDataAccess | ( | ) |
|
inline |
|
inline |
unsigned char xbot::Xbot::getPitchPlatformDegree | ( | ) | const |
bool xbot::Xbot::getStopButtonState | ( | ) | const |
void xbot::Xbot::getWheelJointStates | ( | float & | wheel_left_angle, |
float & | wheel_left_angle_rate, | ||
float & | wheel_right_angle, | ||
float & | wheel_right_angle_rate | ||
) |
unsigned char xbot::Xbot::getYawPlatformDegree | ( | ) | const |
void xbot::Xbot::init | ( | Parameters & | parameters | ) | |
throw | ( | ecl::StandardException | |||
) |
|
inline |
|
inline |
|
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 xbot_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). |
void xbot::Xbot::sensor_fixPayload | ( | ecl::PushAndPop< unsigned char > & | byteStream | ) |
void xbot::Xbot::setBaseControl | ( | const float & | linear_velocity, |
const float & | angular_velocity | ||
) |
void xbot::Xbot::setLiftControl | ( | const unsigned char & | height_percent | ) |
void xbot::Xbot::setPitchPlatformControl | ( | const int & | pitch_degree | ) |
void xbot::Xbot::setSoundEnableControl | ( | const bool & | sound | ) |
void xbot::Xbot::setYawPlatformControl | ( | const int & | yaw_degree | ) |
|
inline |
void xbot::Xbot::updateOdometry | ( | ecl::Pose2D< 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. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |