Skip to content

Commit e81e154

Browse files
authored
Catch missed read/write packets (#19)
1 parent 22bd0a1 commit e81e154

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

robotiq_driver/src/hardware_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ RobotiqGripperHardwareInterface::on_activate(const rclcpp_lifecycle::State& /*pr
211211
}
212212
catch (serial::IOException& e)
213213
{
214-
RCLCPP_ERROR(kLogger, "Check Robotiq Gripper connection and restart drivers.");
214+
RCLCPP_ERROR(kLogger, "Check Robotiq Gripper connection and restart drivers. ERROR: %s", e.what());
215215
command_interface_is_running_.store(false);
216216
}
217217
}

robotiq_driver/src/robotiq_gripper_interface.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ void RobotiqGripperInterface::setGripperPosition(uint8_t pos)
152152
{
153153
// catch connection error and rethrow
154154
std::cerr << "Failed to set gripper position\n";
155+
if (port_.isOpen())
156+
{
157+
std::cerr << "Error caught while reading or writing to device. Connection is open, continuing to attempt communication with gripper.\n ERROR: " << e.what();
158+
return;
159+
}
155160
throw;
156161
}
157162
}
@@ -320,6 +325,11 @@ void RobotiqGripperInterface::updateStatus()
320325
catch (const serial::IOException& e)
321326
{
322327
std::cerr << "Failed to update gripper status.\n";
328+
if (port_.isOpen())
329+
{
330+
std::cerr << "Error caught while reading or writing to device. Connection is open, continuing to attempt communication with gripper.\n ERROR: " << e.what();
331+
return;
332+
}
323333
throw;
324334
}
325335
}

0 commit comments

Comments
 (0)