Skip to content

Commit

Permalink
Catch exceptions in the acknowledge part
Browse files Browse the repository at this point in the history
This hopefully fixes the dying driver after calls to /toggle_grip.
  • Loading branch information
stefanscherzinger committed Oct 21, 2024
1 parent d313371 commit e51f834
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion schunk_egu_egk_gripper_driver/src/schunk_gripper_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,31 @@ void SchunkGripperNode::toggle_grip_srv(const std::shared_ptr<std_srvs::srv::Tri
RCLCPP_WARN(this->get_logger(),"COMMAND FAILED");
res->success = false;
}
acknowledge();

const std::lock_guard<std::recursive_mutex> lock(lock_mutex);

actual_command = "ACKNOWLEDGE";
try
{
acknowledge();
if(check())
{
res->success = true;
RCLCPP_WARN(this->get_logger(),"Acknowledged");
}
else
{
res->success = false;
RCLCPP_WARN(this->get_logger(),"Acknowledge failed!");
}
}
catch(const char* server_err)
{
connection_error = server_err ;
RCLCPP_ERROR(this->get_logger(), "Failed Connection! %s", connection_error.c_str());
res->success = false;
RCLCPP_WARN(this->get_logger(), "Acknowledge failed!");
}
last_command = 0;
gripper_updater->force_update();
finishedCommand();
Expand Down

0 comments on commit e51f834

Please sign in to comment.