Skip to content

Commit 0c96beb

Browse files
destogllivanov93fmauch
authored
Backport: Change driver constructor and change calibration check (#282) (#302)
* Change driver constructor and change calibration check (#282) * fix loading the kinematics hash without quotes Co-authored-by: livanov93 <[email protected]> Co-authored-by: Felix Exner <[email protected]>
1 parent d5df5e1 commit 0c96beb

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

ur_description/urdf/ur.ros2_control.xacro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<param name="servoj_gain">2000</param>
3030
<param name="servoj_lookahead_time">0.03</param>
3131
<param name="use_tool_communication">0</param>
32-
<param name="kinematics/hash">"${hash_kinematics}"</param>
32+
<param name="kinematics/hash">${hash_kinematics}</param>
3333
<param name="tool_voltage">0</param>
3434
<param name="tool_parity">0</param>
3535
<param name="tool_baud_rate">115200</param>

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ return_type URPositionHardwareInterface::start()
341341
ur_driver_ = std::make_unique<urcl::UrDriver>(
342342
robot_ip, script_filename, output_recipe_filename, input_recipe_filename,
343343
std::bind(&URPositionHardwareInterface::handleRobotProgramState, this, std::placeholders::_1), headless_mode,
344-
std::move(tool_comm_setup), calibration_checksum, (uint32_t)reverse_port, (uint32_t)script_sender_port,
345-
servoj_gain, servoj_lookahead_time, non_blocking_read_);
344+
std::move(tool_comm_setup), (uint32_t)reverse_port, (uint32_t)script_sender_port, servoj_gain,
345+
servoj_lookahead_time, non_blocking_read_);
346346
} catch (urcl::ToolCommNotAvailable& e) {
347347
RCLCPP_FATAL_STREAM(rclcpp::get_logger("URPositionHardwareInterface"), "See parameter use_tool_communication");
348348

@@ -351,6 +351,28 @@ return_type URPositionHardwareInterface::start()
351351
RCLCPP_FATAL_STREAM(rclcpp::get_logger("URPositionHardwareInterface"), e.what());
352352
return return_type::ERROR;
353353
}
354+
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Calibration checksum: '%s'.",
355+
calibration_checksum.c_str());
356+
// check calibration
357+
// https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/c3378599d5fa73a261328b326392e847f312ab6b/ur_robot_driver/src/hardware_interface.cpp#L296-L309
358+
if (ur_driver_->checkCalibration(calibration_checksum)) {
359+
RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Calibration checked successfully.");
360+
} else {
361+
RCLCPP_ERROR_STREAM(rclcpp::get_logger("URPositionHardwareInterface"), "The calibration parameters of the "
362+
"connected robot don't match the ones from "
363+
"the given kinematics "
364+
"config file. Please be aware that this can "
365+
"lead to critical inaccuracies of tcp "
366+
"positions. Use "
367+
"the ur_calibration tool to extract the "
368+
"correct calibration from the robot and "
369+
"pass that into the "
370+
"description. See "
371+
"[https://github.com/UniversalRobots/"
372+
"Universal_Robots_ROS_Driver#extract-"
373+
"calibration-information] "
374+
"for details.");
375+
}
354376

355377
ur_driver_->startRTDECommunication();
356378

0 commit comments

Comments
 (0)