14 #include <franka_msgs/ErrorRecoveryAction.h> 21 bool success = CombinedRobotHW::init(root_nh, robot_hw_nh);
24 std::make_unique<actionlib::SimpleActionServer<franka_msgs::ErrorRecoveryAction>>(
25 robot_hw_nh,
"error_recovery",
26 [&](
const franka_msgs::ErrorRecoveryGoalConstPtr&) {
30 auto* franka_combinable_hw_ptr =
32 if (franka_combinable_hw_ptr !=
nullptr) {
36 "FrankaCombinedHW: dynamic_cast from RobotHW to FrankaCombinableHW failed.");
39 franka_msgs::ErrorRecoveryResult(),
40 "dynamic_cast from RobotHW to FrankaCombinableHW failed");
59 CombinedRobotHW::read(time, period);
65 bool controller_reset =
false;
68 if (franka_combinable_hw_ptr !=
nullptr) {
71 ROS_ERROR(
"FrankaCombinedHW: dynamic_cast from RobotHW to FrankaCombinableHW failed.");
75 return controller_reset;
86 bool has_error =
false;
89 if (franka_combinable_hw_ptr !=
nullptr) {
90 has_error = has_error || franka_combinable_hw_ptr->
hasError();
92 ROS_ERROR(
"FrankaCombinedHW: dynamic_cast from RobotHW to FrankaCombinableHW failed.");
103 if (franka_combinable_hw_ptr !=
nullptr) {
106 ROS_ERROR(
"FrankaCombinedHW: dynamic_cast from RobotHW to FrankaCombinableHW failed.");
std::vector< hardware_interface::RobotHWSharedPtr > robot_hw_list_
void triggerError()
Triggers a stop of the controlLoop.
bool controllerNeedsReset()
Checks whether the controller needs to be reset.
A hardware class for a Panda robot based on the ros_control framework.
bool hasError() const noexcept
Getter for the error flag of the class.
bool init(ros::NodeHandle &root_nh, ros::NodeHandle &robot_hw_nh) override
The init function is called to initialize the CombinedFrankaHW from a non-realtime thread...
void resetError()
Recovers the libfranka robot, resets the error flag and publishes the error state.
FrankaCombinedHW()
Creates an instance of CombinedFrankaHW.
std::unique_ptr< actionlib::SimpleActionServer< franka_msgs::ErrorRecoveryAction > > combined_recovery_action_server_
bool controllerNeedsReset() const noexcept
Returns whether the controller needs to be reset e.g.
void read(const ros::Time &time, const ros::Duration &period) override
Reads data from the robot HW.