diff --git a/my_robot_cell/doc/start_ur_driver.rst b/my_robot_cell/doc/start_ur_driver.rst index 1e24ede..1a228e2 100644 --- a/my_robot_cell/doc/start_ur_driver.rst +++ b/my_robot_cell/doc/start_ur_driver.rst @@ -129,3 +129,15 @@ Or to use it with a real robot: #start the driver with real hardware ros2 launch my_robot_cell_control start_robot.launch.py + +.. note:: + We extracted the calibration information from the robot and saved it in the + ``my_robot_cell_control`` package. If you have a different robot, you need to extract the + calibration information from that, and pass that to the launch file. Changing the ``ur_type`` + parameter only will lead to a wrong model, as it will still be using the example kinematics from + a UR20. To use a UR5e, for example, you can do + + .. code-block:: bash + + ros2 launch my_robot_cell_control start_robot.launch.py ur_type:=ur5e use_mock_hardware:=true \ + kinematics_parameters_file:=$(ros2 pkg prefix ur_description)/share/ur_description/config/ur5e/default_kinematics.yaml diff --git a/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py b/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py index 02b13ac..e6d8e35 100644 --- a/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py +++ b/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py @@ -1,5 +1,6 @@ from launch import LaunchDescription -from launch.substitutions import Command, PathJoinSubstitution +from launch.actions import DeclareLaunchArgument +from launch.substitutions import Command, PathJoinSubstitution, LaunchConfiguration from launch_ros.actions import Node from launch_ros.parameter_descriptions import ParameterValue @@ -7,6 +8,7 @@ def generate_launch_description(): + ur_type = LaunchConfiguration("ur_type") description_package = FindPackageShare("my_robot_cell_description") description_file = PathJoinSubstitution( [description_package, "urdf", "my_robot_cell.urdf.xacro"] @@ -14,7 +16,7 @@ def generate_launch_description(): rvizconfig_file = PathJoinSubstitution([description_package, "rviz", "urdf.rviz"]) robot_description = ParameterValue( - Command(["xacro ", description_file, " ", "ur_type:=", "ur20"]), value_type=str + Command(["xacro ", description_file, " ", "ur_type:=", ur_type]), value_type=str ) robot_state_publisher_node = Node( @@ -36,6 +38,30 @@ def generate_launch_description(): arguments=["-d", rvizconfig_file], ) + declared_arguments = [ + DeclareLaunchArgument( + "ur_type", + description="Typo/series of used UR robot.", + choices=[ + "ur3", + "ur3e", + "ur5", + "ur5e", + "ur10", + "ur10e", + "ur16e", + "ur20", + "ur30", + ], + default_value="ur20", + ) + ] + return LaunchDescription( - [joint_state_publisher_gui_node, robot_state_publisher_node, rviz_node] + declared_arguments + + [ + joint_state_publisher_gui_node, + robot_state_publisher_node, + rviz_node, + ] )