Public Member Functions | Private Member Functions | Private Attributes | List of all members
kobuki::KobukiRos Class Reference

#include <kobuki_ros.hpp>

Public Member Functions

bool init (ros::NodeHandle &nh, ros::NodeHandle &nh_pub)
 
 KobukiRos (std::string &node_name)
 Default constructor. More...
 
bool update ()
 
 ~KobukiRos ()
 

Private Member Functions

void advertiseTopics (ros::NodeHandle &nh)
 
void processStreamData ()
 
void publishBumperEvent (const BumperEvent &event)
 
void publishButtonEvent (const ButtonEvent &event)
 
void publishCliffEvent (const CliffEvent &event)
 
void publishControllerInfo ()
 
void publishDockIRData ()
 
void publishInertia ()
 
void publishInputEvent (const InputEvent &event)
 
void publishPowerEvent (const PowerEvent &event)
 
void publishRawControlCommand (const std::vector< short > &velocity_commands)
 
void publishRawDataCommand (Command::Buffer &buffer)
 Prints the raw data stream to a publisher. More...
 
void publishRawDataStream (PacketFinder::BufferType &buffer)
 Prints the raw data stream to a publisher. More...
 
void publishRawInertia ()
 
void publishRobotEvent (const RobotEvent &event)
 
void publishSensorState ()
 
void publishVersionInfo (const VersionInfo &version_info)
 Publish fw, hw, sw version information. More...
 
void publishWheelEvent (const WheelEvent &event)
 
void publishWheelState ()
 
void rosDebug (const std::string &msg)
 
void rosError (const std::string &msg)
 
void rosInfo (const std::string &msg)
 
void rosNamed (const std::vector< std::string > &msgs)
 
void rosWarn (const std::string &msg)
 
void subscribeControllerInfoCommand (const kobuki_msgs::ControllerInfoConstPtr msg)
 
void subscribeDigitalOutputCommand (const kobuki_msgs::DigitalOutputConstPtr)
 
void subscribeExternalPowerCommand (const kobuki_msgs::ExternalPowerConstPtr)
 
void subscribeLed1Command (const kobuki_msgs::LedConstPtr)
 
void subscribeLed2Command (const kobuki_msgs::LedConstPtr)
 
void subscribeMotorPower (const kobuki_msgs::MotorPowerConstPtr msg)
 
void subscribeResetOdometry (const std_msgs::EmptyConstPtr)
 Reset the odometry variables. More...
 
void subscribeSoundCommand (const kobuki_msgs::SoundConstPtr)
 Play a predefined sound (single sound or sound sequence) More...
 
void subscribeTopics (ros::NodeHandle &nh)
 
void subscribeVelocityCommand (const geometry_msgs::TwistConstPtr)
 

Private Attributes

AnalogInputTask ainput_diagnostics
 
BatteryTask battery_diagnostics
 
WallSensorTask bumper_diagnostics
 
ros::Publisher bumper_event_publisher
 
ros::Publisher button_event_publisher
 
CliffSensorTask cliff_diagnostics
 
ros::Publisher cliff_event_publisher
 
bool cmd_vel_timed_out_
 
ros::Subscriber controller_info_command_subscriber
 
ros::Publisher controller_info_publisher
 
ros::Subscriber digital_output_command_subscriber
 
DigitalInputTask dinput_diagnostics
 
ros::Publisher dock_ir_publisher
 
ros::Subscriber external_power_command_subscriber
 
GyroSensorTask gyro_diagnostics
 
ros::Publisher imu_data_publisher
 
ros::Publisher input_event_publisher
 
ros::Publisher joint_state_publisher
 
sensor_msgs::JointState joint_states
 
Kobuki kobuki
 
ros::Subscriber led1_command_subscriber
 
ros::Subscriber led2_command_subscriber
 
MotorCurrentTask motor_diagnostics
 
ros::Subscriber motor_power_subscriber
 
std::string name
 
Odometry odometry
 
ros::Publisher power_event_publisher
 
ros::Publisher raw_control_command_publisher
 
ros::Publisher raw_data_command_publisher
 
ros::Publisher raw_data_stream_publisher
 
ros::Publisher raw_imu_data_publisher
 
ros::Subscriber reset_odometry_subscriber
 
ros::Publisher robot_event_publisher
 
ros::Publisher sensor_state_publisher
 
bool serial_timed_out_
 
ecl::Slot< const BumperEvent & > slot_bumper_event
 
ecl::Slot< const ButtonEvent & > slot_button_event
 
ecl::Slot< const CliffEvent & > slot_cliff_event
 
ecl::Slot slot_controller_info
 
ecl::Slot< const std::string & > slot_debug
 
ecl::Slot< const std::string & > slot_error
 
ecl::Slot< const std::string & > slot_info
 
ecl::Slot< const InputEvent & > slot_input_event
 
ecl::Slot< const std::vector< std::string > & > slot_named
 
ecl::Slot< const PowerEvent & > slot_power_event
 
ecl::Slot< const std::vector< short > & > slot_raw_control_command
 
ecl::Slot< Command::Buffer & > slot_raw_data_command
 
ecl::Slot< PacketFinder::BufferType & > slot_raw_data_stream
 
ecl::Slot< const RobotEvent & > slot_robot_event
 
ecl::Slot slot_stream_data
 
ecl::Slot< const VersionInfo & > slot_version_info
 
ecl::Slot< const std::string & > slot_warn
 
ecl::Slot< const WheelEvent & > slot_wheel_event
 
ros::Subscriber sound_command_subscriber
 
MotorStateTask state_diagnostics
 
diagnostic_updater::Updater updater
 
ros::Subscriber velocity_command_subscriber
 
ros::Publisher version_info_publisher
 
WatchdogTask watchdog_diagnostics
 
WheelDropTask wheel_diagnostics
 
ros::Publisher wheel_event_publisher
 

Detailed Description

Definition at line 84 of file kobuki_ros.hpp.

Constructor & Destructor Documentation

kobuki::KobukiRos::KobukiRos ( std::string node_name)

Default constructor.

Make sure you call the init() method to fully define this node.

Definition at line 61 of file kobuki_ros.cpp.

kobuki::KobukiRos::~KobukiRos ( )

This will wait some time while kobuki internally closes its threads and destructs itself.

Definition at line 99 of file kobuki_ros.cpp.

Member Function Documentation

void kobuki::KobukiRos::advertiseTopics ( ros::NodeHandle nh)
private

Two groups of publishers, one required by turtlebot, the other for kobuki esoterics.

Definition at line 303 of file kobuki_ros.cpp.

bool kobuki::KobukiRos::init ( ros::NodeHandle nh,
ros::NodeHandle nh_pub 
)

Definition at line 104 of file kobuki_ros.cpp.

void kobuki::KobukiRos::processStreamData ( )
private

Definition at line 49 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishBumperEvent ( const BumperEvent event)
private

Definition at line 287 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishButtonEvent ( const ButtonEvent event)
private

Definition at line 267 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishCliffEvent ( const CliffEvent event)
private

Definition at line 307 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishControllerInfo ( )
private

Definition at line 247 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishDockIRData ( )
private

Definition at line 184 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishInertia ( )
private

Definition at line 117 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishInputEvent ( const InputEvent event)
private

Definition at line 371 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishPowerEvent ( const PowerEvent event)
private

Definition at line 347 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishRawControlCommand ( const std::vector< short > &  velocity_commands)
private

Definition at line 472 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishRawDataCommand ( Command::Buffer buffer)
private

Prints the raw data stream to a publisher.

This is a lazy publisher, it only publishes if someone is listening. It publishes the hex byte values of the raw data commands. Useful for debugging command to protocol byte packets to the firmware.

The signal which calls this function is sending a copy of the buffer (don't worry about mutexes). Be ideal if we used const PacketFinder::BufferType here, but haven't updated PushPop to work with consts yet.

Parameters
buffer

Definition at line 410 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishRawDataStream ( PacketFinder::BufferType buffer)
private

Prints the raw data stream to a publisher.

This is a lazy publisher, it only publishes if someone is listening. It publishes the hex byte values of the raw data (incoming) stream. Useful for checking when bytes get mangled.

The signal which calls this function is sending a copy of the buffer (don't worry about mutexes). Be ideal if we used const PacketFinder::BufferType here, but haven't updated PushPop to work with consts yet.

Parameters
buffer

Definition at line 437 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishRawInertia ( )
private

Definition at line 152 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishRobotEvent ( const RobotEvent event)
private

Definition at line 382 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishSensorState ( )
private

Definition at line 61 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishVersionInfo ( const VersionInfo version_info)
private

Publish fw, hw, sw version information.

The driver will only gather this data when initialising so it is important that this publisher is latched.

Definition at line 216 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishWheelEvent ( const WheelEvent event)
private

Definition at line 328 of file slot_callbacks.cpp.

void kobuki::KobukiRos::publishWheelState ( )
private

Definition at line 98 of file slot_callbacks.cpp.

void kobuki::KobukiRos::rosDebug ( const std::string msg)
inlineprivate

Definition at line 174 of file kobuki_ros.hpp.

void kobuki::KobukiRos::rosError ( const std::string msg)
inlineprivate

Definition at line 177 of file kobuki_ros.hpp.

void kobuki::KobukiRos::rosInfo ( const std::string msg)
inlineprivate

Definition at line 175 of file kobuki_ros.hpp.

void kobuki::KobukiRos::rosNamed ( const std::vector< std::string > &  msgs)
inlineprivate

Definition at line 178 of file kobuki_ros.hpp.

void kobuki::KobukiRos::rosWarn ( const std::string msg)
inlineprivate

Definition at line 176 of file kobuki_ros.hpp.

void kobuki::KobukiRos::subscribeControllerInfoCommand ( const kobuki_msgs::ControllerInfoConstPtr  msg)
private

Definition at line 228 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeDigitalOutputCommand ( const kobuki_msgs::DigitalOutputConstPtr  msg)
private

Definition at line 93 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeExternalPowerCommand ( const kobuki_msgs::ExternalPowerConstPtr  msg)
private

Definition at line 104 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeLed1Command ( const kobuki_msgs::LedConstPtr  msg)
private

Definition at line 69 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeLed2Command ( const kobuki_msgs::LedConstPtr  msg)
private

Definition at line 81 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeMotorPower ( const kobuki_msgs::MotorPowerConstPtr  msg)
private

Definition at line 207 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeResetOdometry ( const std_msgs::EmptyConstPtr  )
private

Reset the odometry variables.

Definition at line 195 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeSoundCommand ( const kobuki_msgs::SoundConstPtr  msg)
private

Play a predefined sound (single sound or sound sequence)

Definition at line 155 of file subscriber_callbacks.cpp.

void kobuki::KobukiRos::subscribeTopics ( ros::NodeHandle nh)
private

Two groups of subscribers, one required by turtlebot, the other for kobuki esoterics.

Definition at line 335 of file kobuki_ros.cpp.

void kobuki::KobukiRos::subscribeVelocityCommand ( const geometry_msgs::TwistConstPtr  msg)
private

Definition at line 53 of file subscriber_callbacks.cpp.

bool kobuki::KobukiRos::update ( )

This is a worker function that runs in a background thread initiated by the nodelet. It gathers diagnostics information from the kobuki driver, and broadcasts the results to the rest of the ros ecosystem.

Note that the actual driver data is collected via the slot callbacks in this class.

Returns
Bool : true/false if successfully updated or not (kobuki driver shutdown).

Definition at line 248 of file kobuki_ros.cpp.

Member Data Documentation

AnalogInputTask kobuki::KobukiRos::ainput_diagnostics
private

Definition at line 214 of file kobuki_ros.hpp.

BatteryTask kobuki::KobukiRos::battery_diagnostics
private

Definition at line 205 of file kobuki_ros.hpp.

WallSensorTask kobuki::KobukiRos::bumper_diagnostics
private

Definition at line 208 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::bumper_event_publisher
private

Definition at line 110 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::button_event_publisher
private

Definition at line 109 of file kobuki_ros.hpp.

CliffSensorTask kobuki::KobukiRos::cliff_diagnostics
private

Definition at line 207 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::cliff_event_publisher
private

Definition at line 110 of file kobuki_ros.hpp.

bool kobuki::KobukiRos::cmd_vel_timed_out_
private

Definition at line 101 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::controller_info_command_subscriber
private

Definition at line 114 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::controller_info_publisher
private

Definition at line 107 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::digital_output_command_subscriber
private

Definition at line 113 of file kobuki_ros.hpp.

DigitalInputTask kobuki::KobukiRos::dinput_diagnostics
private

Definition at line 213 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::dock_ir_publisher
private

Definition at line 108 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::external_power_command_subscriber
private

Definition at line 113 of file kobuki_ros.hpp.

GyroSensorTask kobuki::KobukiRos::gyro_diagnostics
private

Definition at line 212 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::imu_data_publisher
private

Definition at line 108 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::input_event_publisher
private

Definition at line 109 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::joint_state_publisher
private

Definition at line 108 of file kobuki_ros.hpp.

sensor_msgs::JointState kobuki::KobukiRos::joint_states
private

Definition at line 99 of file kobuki_ros.hpp.

Kobuki kobuki::KobukiRos::kobuki
private

Definition at line 98 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::led1_command_subscriber
private

Definition at line 115 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::led2_command_subscriber
private

Definition at line 115 of file kobuki_ros.hpp.

MotorCurrentTask kobuki::KobukiRos::motor_diagnostics
private

Definition at line 210 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::motor_power_subscriber
private

Definition at line 116 of file kobuki_ros.hpp.

std::string kobuki::KobukiRos::name
private

Definition at line 97 of file kobuki_ros.hpp.

Odometry kobuki::KobukiRos::odometry
private

Definition at line 100 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::power_event_publisher
private

Definition at line 110 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::raw_control_command_publisher
private

Definition at line 111 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::raw_data_command_publisher
private

Definition at line 111 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::raw_data_stream_publisher
private

Definition at line 111 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::raw_imu_data_publisher
private

Definition at line 108 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::reset_odometry_subscriber
private

Definition at line 116 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::robot_event_publisher
private

Definition at line 109 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::sensor_state_publisher
private

Definition at line 108 of file kobuki_ros.hpp.

bool kobuki::KobukiRos::serial_timed_out_
private

Definition at line 102 of file kobuki_ros.hpp.

ecl::Slot<const BumperEvent&> kobuki::KobukiRos::slot_bumper_event
private

Definition at line 141 of file kobuki_ros.hpp.

ecl::Slot<const ButtonEvent&> kobuki::KobukiRos::slot_button_event
private

Definition at line 140 of file kobuki_ros.hpp.

ecl::Slot<const CliffEvent&> kobuki::KobukiRos::slot_cliff_event
private

Definition at line 142 of file kobuki_ros.hpp.

ecl::Slot kobuki::KobukiRos::slot_controller_info
private

Definition at line 139 of file kobuki_ros.hpp.

ecl::Slot<const std::string&> kobuki::KobukiRos::slot_debug
private

Definition at line 147 of file kobuki_ros.hpp.

ecl::Slot<const std::string&> kobuki::KobukiRos::slot_error
private

Definition at line 147 of file kobuki_ros.hpp.

ecl::Slot<const std::string&> kobuki::KobukiRos::slot_info
private

Definition at line 147 of file kobuki_ros.hpp.

ecl::Slot<const InputEvent&> kobuki::KobukiRos::slot_input_event
private

Definition at line 145 of file kobuki_ros.hpp.

ecl::Slot<const std::vector<std::string>&> kobuki::KobukiRos::slot_named
private

Definition at line 148 of file kobuki_ros.hpp.

ecl::Slot<const PowerEvent&> kobuki::KobukiRos::slot_power_event
private

Definition at line 144 of file kobuki_ros.hpp.

ecl::Slot<const std::vector<short>&> kobuki::KobukiRos::slot_raw_control_command
private

Definition at line 151 of file kobuki_ros.hpp.

ecl::Slot<Command::Buffer&> kobuki::KobukiRos::slot_raw_data_command
private

Definition at line 149 of file kobuki_ros.hpp.

ecl::Slot<PacketFinder::BufferType&> kobuki::KobukiRos::slot_raw_data_stream
private

Definition at line 150 of file kobuki_ros.hpp.

ecl::Slot<const RobotEvent&> kobuki::KobukiRos::slot_robot_event
private

Definition at line 146 of file kobuki_ros.hpp.

ecl::Slot kobuki::KobukiRos::slot_stream_data
private

Definition at line 138 of file kobuki_ros.hpp.

ecl::Slot<const VersionInfo&> kobuki::KobukiRos::slot_version_info
private

Definition at line 137 of file kobuki_ros.hpp.

ecl::Slot<const std::string&> kobuki::KobukiRos::slot_warn
private

Definition at line 147 of file kobuki_ros.hpp.

ecl::Slot<const WheelEvent&> kobuki::KobukiRos::slot_wheel_event
private

Definition at line 143 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::sound_command_subscriber
private

Definition at line 115 of file kobuki_ros.hpp.

MotorStateTask kobuki::KobukiRos::state_diagnostics
private

Definition at line 211 of file kobuki_ros.hpp.

diagnostic_updater::Updater kobuki::KobukiRos::updater
private

Definition at line 204 of file kobuki_ros.hpp.

ros::Subscriber kobuki::KobukiRos::velocity_command_subscriber
private

Definition at line 113 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::version_info_publisher
private

Definition at line 107 of file kobuki_ros.hpp.

WatchdogTask kobuki::KobukiRos::watchdog_diagnostics
private

Definition at line 206 of file kobuki_ros.hpp.

WheelDropTask kobuki::KobukiRos::wheel_diagnostics
private

Definition at line 209 of file kobuki_ros.hpp.

ros::Publisher kobuki::KobukiRos::wheel_event_publisher
private

Definition at line 110 of file kobuki_ros.hpp.


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


kobuki_node
Author(s): Daniel Stonier, Younghun Ju, Jorge Santos Simon
autogenerated on Mon Jun 10 2019 13:45:13