From b73112e2f0afe0f49b2d7a534392e2930da73a96 Mon Sep 17 00:00:00 2001 From: urmarp Date: Wed, 28 Dec 2022 11:40:12 +0100 Subject: [PATCH] Updated for improvement of primary interface Added feature to tell if robot is simulated or real --- ur_robot_driver/launch/ur10_bringup.launch | 1 + ur_robot_driver/launch/ur10e_bringup.launch | 1 + ur_robot_driver/launch/ur16e_bringup.launch | 1 + ur_robot_driver/launch/ur3_bringup.launch | 1 + ur_robot_driver/launch/ur3e_bringup.launch | 1 + ur_robot_driver/launch/ur5_bringup.launch | 1 + ur_robot_driver/launch/ur5e_bringup.launch | 1 + ur_robot_driver/launch/ur_common.launch | 4 +++- ur_robot_driver/launch/ur_control.launch | 2 ++ ur_robot_driver/src/hardware_interface.cpp | 22 +++++++-------------- ur_robot_driver/test/driver.test | 1 + 11 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ur_robot_driver/launch/ur10_bringup.launch b/ur_robot_driver/launch/ur10_bringup.launch index 8686e418c..5b5312af7 100644 --- a/ur_robot_driver/launch/ur10_bringup.launch +++ b/ur_robot_driver/launch/ur10_bringup.launch @@ -14,6 +14,7 @@ + diff --git a/ur_robot_driver/launch/ur10e_bringup.launch b/ur_robot_driver/launch/ur10e_bringup.launch index 2b98f6407..4962672ec 100644 --- a/ur_robot_driver/launch/ur10e_bringup.launch +++ b/ur_robot_driver/launch/ur10e_bringup.launch @@ -24,6 +24,7 @@ + diff --git a/ur_robot_driver/launch/ur16e_bringup.launch b/ur_robot_driver/launch/ur16e_bringup.launch index 40b6a7bf8..3930b82da 100644 --- a/ur_robot_driver/launch/ur16e_bringup.launch +++ b/ur_robot_driver/launch/ur16e_bringup.launch @@ -24,6 +24,7 @@ + diff --git a/ur_robot_driver/launch/ur3_bringup.launch b/ur_robot_driver/launch/ur3_bringup.launch index 764b36634..4d136ec91 100644 --- a/ur_robot_driver/launch/ur3_bringup.launch +++ b/ur_robot_driver/launch/ur3_bringup.launch @@ -14,6 +14,7 @@ + diff --git a/ur_robot_driver/launch/ur3e_bringup.launch b/ur_robot_driver/launch/ur3e_bringup.launch index bbf4ff696..e2ebc69d5 100644 --- a/ur_robot_driver/launch/ur3e_bringup.launch +++ b/ur_robot_driver/launch/ur3e_bringup.launch @@ -23,6 +23,7 @@ + diff --git a/ur_robot_driver/launch/ur5_bringup.launch b/ur_robot_driver/launch/ur5_bringup.launch index 619118c2a..926731c68 100644 --- a/ur_robot_driver/launch/ur5_bringup.launch +++ b/ur_robot_driver/launch/ur5_bringup.launch @@ -14,6 +14,7 @@ + diff --git a/ur_robot_driver/launch/ur5e_bringup.launch b/ur_robot_driver/launch/ur5e_bringup.launch index 10a03b253..5c440cb4f 100644 --- a/ur_robot_driver/launch/ur5e_bringup.launch +++ b/ur_robot_driver/launch/ur5e_bringup.launch @@ -23,6 +23,7 @@ + diff --git a/ur_robot_driver/launch/ur_common.launch b/ur_robot_driver/launch/ur_common.launch index 1699ec2b2..b41944ef5 100644 --- a/ur_robot_driver/launch/ur_common.launch +++ b/ur_robot_driver/launch/ur_common.launch @@ -23,6 +23,7 @@ + @@ -56,6 +57,7 @@ - + + diff --git a/ur_robot_driver/launch/ur_control.launch b/ur_robot_driver/launch/ur_control.launch index 4d842e2e5..a301dc440 100644 --- a/ur_robot_driver/launch/ur_control.launch +++ b/ur_robot_driver/launch/ur_control.launch @@ -30,6 +30,7 @@ + @@ -56,6 +57,7 @@ + diff --git a/ur_robot_driver/src/hardware_interface.cpp b/ur_robot_driver/src/hardware_interface.cpp index 9d6810768..c2acd4780 100644 --- a/ur_robot_driver/src/hardware_interface.cpp +++ b/ur_robot_driver/src/hardware_interface.cpp @@ -277,6 +277,12 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw // endeffector might be inaccurate. See the "ur_calibration" package on help how to generate your // own hash matching your actual robot. std::string calibration_checksum = robot_hw_nh.param("kinematics/hash", ""); + bool simulated_robot = false; + if (!robot_hw_nh.getParam("simulated_robot", simulated_robot)) + { + ROS_ERROR_STREAM("Required parameter " << robot_hw_nh.resolveName("simulated_robot") << " not given."); + return false; + } ROS_INFO_STREAM("Initializing dashboard client"); ros::NodeHandle dashboard_nh(robot_hw_nh, "dashboard"); dashboard_client_.reset(new DashboardClientROS(dashboard_nh, robot_ip_)); @@ -286,7 +292,7 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw ur_driver_.reset(new urcl::UrDriver( robot_ip_, script_filename, output_recipe_filename, input_recipe_filename, std::bind(&HardwareInterface::handleRobotProgramState, this, std::placeholders::_1), headless_mode, - std::move(tool_comm_setup), (uint32_t)reverse_port, (uint32_t)script_sender_port, servoj_gain, + std::move(tool_comm_setup), calibration_checksum, simulated_robot, (uint32_t)reverse_port, (uint32_t)script_sender_port, servoj_gain, servoj_lookahead_time, non_blocking_read_, reverse_ip, trajectory_port, script_command_port)); } catch (urcl::ToolCommNotAvailable& e) @@ -299,20 +305,6 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw ROS_FATAL_STREAM(e.what()); return false; } - URCL_LOG_INFO("Checking if calibration data matches connected robot."); - if (ur_driver_->checkCalibration(calibration_checksum)) - { - ROS_INFO_STREAM("Calibration checked successfully."); - } - else - { - ROS_ERROR_STREAM("The calibration parameters of the connected robot don't match the ones from the given kinematics " - "config file. Please be aware that this can lead to critical inaccuracies of tcp positions. Use " - "the ur_calibration tool to extract the correct calibration from the robot and pass that into the " - "description. See " - "[https://github.com/UniversalRobots/Universal_Robots_ROS_Driver#extract-calibration-information] " - "for details."); - } ur_driver_->registerTrajectoryDoneCallback( std::bind(&HardwareInterface::passthroughTrajectoryDoneCb, this, std::placeholders::_1)); diff --git a/ur_robot_driver/test/driver.test b/ur_robot_driver/test/driver.test index e8ec1f72c..2c6f34ce6 100644 --- a/ur_robot_driver/test/driver.test +++ b/ur_robot_driver/test/driver.test @@ -9,6 +9,7 @@ +