#include <safety_controller.hpp>
Public Member Functions | |
bool | init () |
SafetyController (ros::NodeHandle &nh, std::string &name) | |
void | spin () |
~SafetyController () | |
Private Member Functions | |
void | bumperEventCB (const kobuki_msgs::BumperEventConstPtr msg) |
Keeps track of bumps. | |
void | cliffEventCB (const kobuki_msgs::CliffEventConstPtr msg) |
Keeps track of cliff detection. | |
void | disableCB (const std_msgs::EmptyConstPtr msg) |
ROS logging output for disabling the controller. | |
void | enableCB (const std_msgs::EmptyConstPtr msg) |
ROS logging output for enabling the controller. | |
void | resetSafetyStatesCB (const std_msgs::EmptyConstPtr msg) |
Callback for resetting safety variables. | |
void | wheelEventCB (const kobuki_msgs::WheelDropEventConstPtr msg) |
Keeps track of the wheel states. | |
Private Attributes | |
bool | bumper_center_pressed_ |
ros::Subscriber | bumper_event_subscriber_ |
bool | bumper_left_pressed_ |
bool | bumper_right_pressed_ |
bool | cliff_center_detected_ |
ros::Subscriber | cliff_event_subscriber_ |
bool | cliff_left_detected_ |
bool | cliff_right_detected_ |
ros::Publisher | controller_state_publisher_ |
ros::Subscriber | disable_controller_subscriber_ |
ros::Subscriber | enable_controller_subscriber_ |
geometry_msgs::TwistPtr | msg_ |
std::string | name_ |
ros::NodeHandle | nh_ |
ros::Subscriber | reset_safety_states_subscriber_ |
ros::Publisher | velocity_command_publisher_ |
ros::Subscriber | wheel_event_subscriber_ |
bool | wheel_left_dropped_ |
bool | wheel_right_dropped_ |
@ brief Keeps track of safety-related events and commands Kobuki to move accordingly
The SafetyController keeps track of bumper, cliff and wheel drop events. In case of the first two, Kobuki is commanded to move back. In the latter case, Kobuki is stopped. All commands stop when the event condition disappears. In the case of lateral bump/cliff, robot also spins a bit, what makes easier to escape from the risk.
This controller can be enabled/disabled. The safety states (bumper pressed etc.) can be reset. WARNING: Dangerous!
Definition at line 75 of file safety_controller.hpp.
kobuki::SafetyController::SafetyController | ( | ros::NodeHandle & | nh, |
std::string & | name | ||
) | [inline] |
Definition at line 78 of file safety_controller.hpp.
kobuki::SafetyController::~SafetyController | ( | ) | [inline] |
Definition at line 90 of file safety_controller.hpp.
void kobuki::SafetyController::bumperEventCB | ( | const kobuki_msgs::BumperEventConstPtr | msg | ) | [private] |
Keeps track of bumps.
msg | incoming topic message |
Definition at line 216 of file safety_controller.hpp.
void kobuki::SafetyController::cliffEventCB | ( | const kobuki_msgs::CliffEventConstPtr | msg | ) | [private] |
Keeps track of cliff detection.
msg | incoming topic message |
Definition at line 192 of file safety_controller.hpp.
void kobuki::SafetyController::disableCB | ( | const std_msgs::EmptyConstPtr | msg | ) | [private] |
ROS logging output for disabling the controller.
msg | incoming topic message |
Definition at line 180 of file safety_controller.hpp.
void kobuki::SafetyController::enableCB | ( | const std_msgs::EmptyConstPtr | msg | ) | [private] |
ROS logging output for enabling the controller.
msg | incoming topic message |
Definition at line 168 of file safety_controller.hpp.
bool kobuki::SafetyController::init | ( | ) | [inline, virtual] |
Set-up necessary publishers/subscribers and variables
Implements yocs::Controller.
Definition at line 96 of file safety_controller.hpp.
void kobuki::SafetyController::resetSafetyStatesCB | ( | const std_msgs::EmptyConstPtr | msg | ) | [private] |
Callback for resetting safety variables.
Allows resetting bumper, cliff and wheel drop states. DANGEROUS!
msg | incoming topic message |
Definition at line 276 of file safety_controller.hpp.
void kobuki::SafetyController::spin | ( | ) | [virtual] |
@ brief Checks safety states and publishes velocity commands when necessary
Reimplemented from yocs::Controller.
Definition at line 289 of file safety_controller.hpp.
void kobuki::SafetyController::wheelEventCB | ( | const kobuki_msgs::WheelDropEventConstPtr | msg | ) | [private] |
Keeps track of the wheel states.
msg | incoming topic message |
Definition at line 240 of file safety_controller.hpp.
bool kobuki::SafetyController::bumper_center_pressed_ [private] |
Definition at line 121 of file safety_controller.hpp.
Definition at line 117 of file safety_controller.hpp.
bool kobuki::SafetyController::bumper_left_pressed_ [private] |
Definition at line 121 of file safety_controller.hpp.
bool kobuki::SafetyController::bumper_right_pressed_ [private] |
Definition at line 121 of file safety_controller.hpp.
bool kobuki::SafetyController::cliff_center_detected_ [private] |
Definition at line 122 of file safety_controller.hpp.
Definition at line 117 of file safety_controller.hpp.
bool kobuki::SafetyController::cliff_left_detected_ [private] |
Definition at line 122 of file safety_controller.hpp.
bool kobuki::SafetyController::cliff_right_detected_ [private] |
Definition at line 122 of file safety_controller.hpp.
Definition at line 119 of file safety_controller.hpp.
Definition at line 116 of file safety_controller.hpp.
Definition at line 116 of file safety_controller.hpp.
geometry_msgs::TwistPtr kobuki::SafetyController::msg_ [private] |
Definition at line 124 of file safety_controller.hpp.
std::string kobuki::SafetyController::name_ [private] |
Definition at line 115 of file safety_controller.hpp.
ros::NodeHandle kobuki::SafetyController::nh_ [private] |
Definition at line 114 of file safety_controller.hpp.
Definition at line 118 of file safety_controller.hpp.
Definition at line 119 of file safety_controller.hpp.
Definition at line 117 of file safety_controller.hpp.
bool kobuki::SafetyController::wheel_left_dropped_ [private] |
Definition at line 120 of file safety_controller.hpp.
bool kobuki::SafetyController::wheel_right_dropped_ [private] |
Definition at line 120 of file safety_controller.hpp.