From 662e9370779913879e886c2989af809178bbc375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 14:07:53 +0100 Subject: [PATCH 1/7] robot_description: gazebo: update indentation The launch script gazebo.launch.py is a simplified version of the launch script gazebo_move.launch.py; it does no with no MoveIt configuration. Note: The gazebo_move.launch.py outputs the warning below: WARNING:root:"File /home/gportay/src/abmi-software/Robot5A-Simulation/install/robot_moveit_config/share/robot_moveit_config/config/r5a_v_ros.urdf.xacro doesn't exist" WARNING:root:The robot description will be loaded from /robot_description topic --- src/robot_description/launch/gazebo.launch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/robot_description/launch/gazebo.launch.py b/src/robot_description/launch/gazebo.launch.py index 249b408..f5ac216 100644 --- a/src/robot_description/launch/gazebo.launch.py +++ b/src/robot_description/launch/gazebo.launch.py @@ -34,7 +34,6 @@ def generate_launch_description(): # Specify the name of the package and path to xacro file within the package pkg_name = "robot_description" # Name of the robot description package - share_dir = get_package_share_directory( pkg_name ) # Get the share directory of the package @@ -58,6 +57,7 @@ def generate_launch_description(): {"use_sim_time": True}, ], # Parameters ) + # Node to spawn the entity in Gazebo spawn_entity = Node( package="gazebo_ros", # Package containing the node @@ -70,6 +70,7 @@ def generate_launch_description(): ], # Arguments for spawning output="screen", ) + # Include the Gazebo launch file gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -92,6 +93,7 @@ def generate_launch_description(): ], # Command to load and activate joint_state_broadcaster output="screen", ) + load_arm_controller = ExecuteProcess( cmd=[ "ros2", From 841c122e11125e829ed0b3dde2421147f151792a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 15:05:01 +0100 Subject: [PATCH 2/7] robot_description: gazebo_move: fix path to URDF Xacro file The package robot_moveit_config does not contains the URDF Xacro file. The URDF Xacro file r5a_v_ros.urdf.xacro is located in the directory urdf/ of the robot_description package. This fixes the path to the URDF Xacro file to address the error below, it reuses the variable xacro_file containing the full path to the file. Fixes: WARNING:root:"File /home/gportay/src/abmi-software/Robot5A-Simulation/install/robot_moveit_config/share/robot_moveit_config/config/r5a_v_ros.urdf.xacro doesn't ex WARNING:root:The robot description will be loaded from /robot_description topic --- src/robot_description/launch/gazebo_move.launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/robot_description/launch/gazebo_move.launch.py b/src/robot_description/launch/gazebo_move.launch.py index 6e55f44..9b8d312 100644 --- a/src/robot_description/launch/gazebo_move.launch.py +++ b/src/robot_description/launch/gazebo_move.launch.py @@ -111,7 +111,7 @@ def generate_launch_description(): moveit_config = ( MoveItConfigsBuilder("robot_moveit_config", package_name="robot_moveit_config") .robot_description( - file_path="config/r5a_v_ros.urdf.xacro", mappings={"use_sim_time": "true"} + file_path=xacro_file, mappings={"use_sim_time": "true"} ) .robot_description_semantic("config/armr5.srdf") .robot_description_kinematics("config/kinematics.yaml") From 9a0f6d51e5db0001ea1aa46c663f51664b2c6d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 14:07:53 +0100 Subject: [PATCH 3/7] robot_control: visual_sim: update indentation The launch script gazebo_gui.launch.py is a simplified version of the launch script visual_sim.launch.py; it has no camera, no world, no gripper and no aruco. --- src/robot_control/launch/visual_sim.launch.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/robot_control/launch/visual_sim.launch.py b/src/robot_control/launch/visual_sim.launch.py index 5b7f436..eab1ad7 100644 --- a/src/robot_control/launch/visual_sim.launch.py +++ b/src/robot_control/launch/visual_sim.launch.py @@ -32,9 +32,9 @@ def generate_launch_description(): This function sets up the robot description, launches Gazebo with a custom world file, spawns the robot entity, configures MoveIt, and starts the necessary nodes and controllers, including the GUI node, object detector node, and visual joint state publisher node. - + It now accepts a parameter 'num_cameras' to determine whether to launch the single or double ArUco detector. - + @return LaunchDescription object containing all the nodes and configurations to launch. """ @@ -77,7 +77,7 @@ def generate_launch_description(): parameters=[robot_description, {"use_sim_time": True}], ) - # Gazebo launch with a custom world file that includes a spotlight + # Gazebo Launch world_file_path = os.path.join( share_dir, "worlds", "spotlight.world" ) # Path to the custom world file @@ -156,7 +156,6 @@ def generate_launch_description(): ) load_gripper_controller = ExecuteProcess( - cmd=[ "ros2", "control", @@ -166,8 +165,8 @@ def generate_launch_description(): "gripper_controller", ], output="screen", - ) + # Launch the GUI Node gui_node = Node( package="robot_control", # Package name containing the GUI node @@ -177,7 +176,7 @@ def generate_launch_description(): moveit_config.to_dict(), {"use_sim_time": True}, {"moveit_current_state_monitor.joint_state_qos": "sensor_data"}, - ], # Pass MoveIt config to the GUI node + ], # Pass the MoveIt config to the GUI node ) # Aruco Detector Single Node @@ -220,7 +219,6 @@ def generate_launch_description(): output='screen', parameters=[{'use_sim_time': True}] ), - SetParameter(name="use_sim_time", value=True), # Enable simulation time RegisterEventHandler( event_handler=OnProcessExit( @@ -237,8 +235,10 @@ def generate_launch_description(): RegisterEventHandler( event_handler=OnProcessExit( target_action=load_arm_controller, - on_exit=[load_gripper_controller, move_group_node], # Load gripper controller before move group - + on_exit=[ + load_gripper_controller, + move_group_node + ], # Load gripper controller before move group ) ), RegisterEventHandler( From 4df7dbba58e69325e7f23cd5e65138c5ea739541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 15:31:32 +0100 Subject: [PATCH 4/7] robot_control: visual_sim: remove comment This removes the comment specifiying extra debugging argument --- src/robot_control/launch/gazebo_gui.launch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/robot_control/launch/gazebo_gui.launch.py b/src/robot_control/launch/gazebo_gui.launch.py index d60ad89..502cb57 100644 --- a/src/robot_control/launch/gazebo_gui.launch.py +++ b/src/robot_control/launch/gazebo_gui.launch.py @@ -146,7 +146,6 @@ def generate_launch_description(): {"use_sim_time": True}, {"moveit_current_state_monitor.joint_state_qos": "sensor_data"}, ], # Pass the MoveIt config to the GUI node - # arguments=['--ros-args', '--log-level', 'debug'], ) # Return the LaunchDescription From 2cc940cacef4e48c4393fba025cc29c81c848171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 15:40:37 +0100 Subject: [PATCH 5/7] robot_control: moveit_control: fix path to URDF Xacro file The package robot_moveit_config does not contains the URDF Xacro file. The URDF Xacro file r5a_v_ros.urdf.xacro is located in the directory urdf/ of the robot_description package. This fixes the path to the URDF Xacro file to address the error below, it reuses the variable xacro_file containing the full path to the file. Fixes: WARNING:root:"File /home/gportay/src/abmi-software/Robot5A-Simulation-humble/install/robot_moveit_config/share/robot_moveit_config/config/r5a_v_ros.urdf.xacro doesn't exist" WARNING:root:The robot description will be loaded from /robot_description topic --- .../launch/moveit_control.launch.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/robot_control/launch/moveit_control.launch.py b/src/robot_control/launch/moveit_control.launch.py index 43b60bc..a0cb24e 100644 --- a/src/robot_control/launch/moveit_control.launch.py +++ b/src/robot_control/launch/moveit_control.launch.py @@ -8,6 +8,7 @@ import os from launch import LaunchDescription +from ament_index_python.packages import get_package_share_directory from launch_ros.actions import Node from moveit_configs_utils import MoveItConfigsBuilder @@ -22,11 +23,22 @@ def generate_launch_description(): @return LaunchDescription object containing the nodes to launch. """ - # Load the MoveIt configuration using MoveItConfigsBuilder + # Specify the name of the package and path to xacro file within the package + pkg_name = "robot_description" # Name of the robot description package + share_dir = get_package_share_directory( + pkg_name + ) # Get the share directory of the package + + # Use xacro to process the file + xacro_file = os.path.join( + share_dir, "urdf", "r5a_v_ros.urdf.xacro" + ) # Full path to the XACRO file + + # MoveIt configuration using MoveItConfigsBuilder moveit_config = ( MoveItConfigsBuilder("robot_moveit_config", package_name="robot_moveit_config") .robot_description( - file_path="config/r5a_v_ros.urdf.xacro", mappings={"use_sim_time": "true"} + file_path=xacro_file, mappings={"use_sim_time": "true"} ) .robot_description_semantic("config/armr5.srdf") .robot_description_kinematics("config/kinematics.yaml") From 370dcca76794130ed8735d460645675937eab882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 15:47:57 +0100 Subject: [PATCH 6/7] robot_control: moveit_control2: fix path to URDF Xacro file The package robot_moveit_config does not contains the URDF Xacro file. The URDF Xacro file r5a_v_ros.urdf.xacro is located in the directory urdf/ of the robot_description package. This fixes the path to the URDF Xacro file to address the error below, it reuses the variable xacro_file containing the full path to the file. Fixes: WARNING:root:"File /home/gportay/src/abmi-software/Robot5A-Simulation-humble/install/robot_moveit_config/share/robot_moveit_config/config/r5a_v_ros.urdf.xacro doesn't exist" WARNING:root:The robot description will be loaded from /robot_description topic --- .../launch/moveit_control2.launch.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/robot_control/launch/moveit_control2.launch.py b/src/robot_control/launch/moveit_control2.launch.py index 7775394..f1adaa4 100644 --- a/src/robot_control/launch/moveit_control2.launch.py +++ b/src/robot_control/launch/moveit_control2.launch.py @@ -8,6 +8,7 @@ import os from launch import LaunchDescription +from ament_index_python.packages import get_package_share_directory from launch_ros.actions import Node from moveit_configs_utils import MoveItConfigsBuilder @@ -21,11 +22,22 @@ def generate_launch_description(): @return LaunchDescription object containing the robot control node. """ - # Load the MoveIt configuration using MoveItConfigsBuilder + # Specify the name of the package and path to xacro file within the package + pkg_name = "robot_description" # Name of the robot description package + share_dir = get_package_share_directory( + pkg_name + ) # Get the share directory of the package + + # Use xacro to process the file + xacro_file = os.path.join( + share_dir, "urdf", "r5a_v_ros.urdf.xacro" + ) # Full path to the XACRO file + + # MoveIt configuration using MoveItConfigsBuilder moveit_config = ( MoveItConfigsBuilder("robot_moveit_config", package_name="robot_moveit_config") .robot_description( - file_path="config/r5a_v_ros.urdf.xacro", mappings={"use_sim_time": "true"} + file_path=xacro_file, mappings={"use_sim_time": "true"} ) .robot_description_semantic("config/armr5.srdf") .robot_description_kinematics("config/kinematics.yaml") From 6d21cc8db4cd3e11d2c6f45978ddf07dec1bb4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 28 Mar 2025 15:49:20 +0100 Subject: [PATCH 7/7] robot_control: moveit_control_gui: fix path to URDF Xacro file The package robot_moveit_config does not contains the URDF Xacro file. The URDF Xacro file r5a_v_ros.urdf.xacro is located in the directory urdf/ of the robot_description package. This fixes the path to the URDF Xacro file to address the error below, it reuses the variable xacro_file containing the full path to the file. Fixes: WARNING:root:"File /home/gportay/src/abmi-software/Robot5A-Simulation-humble/install/robot_moveit_config/share/robot_moveit_config/config/r5a_v_ros.urdf.xacro doesn't exist" WARNING:root:The robot description will be loaded from /robot_description topic --- .../launch/moveit_control_gui.launch.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/robot_control/launch/moveit_control_gui.launch.py b/src/robot_control/launch/moveit_control_gui.launch.py index a129112..55c4fc1 100644 --- a/src/robot_control/launch/moveit_control_gui.launch.py +++ b/src/robot_control/launch/moveit_control_gui.launch.py @@ -8,6 +8,7 @@ import os from launch import LaunchDescription +from ament_index_python.packages import get_package_share_directory from launch_ros.actions import Node from moveit_configs_utils import MoveItConfigsBuilder @@ -22,11 +23,22 @@ def generate_launch_description(): @return LaunchDescription object containing the GUI node. """ - # Load the MoveIt configuration using MoveItConfigsBuilder + # Specify the name of the package and path to xacro file within the package + pkg_name = "robot_description" # Name of the robot description package + share_dir = get_package_share_directory( + pkg_name + ) # Get the share directory of the package + + # Use xacro to process the file + xacro_file = os.path.join( + share_dir, "urdf", "r5a_v_ros.urdf.xacro" + ) # Full path to the XACRO file + + # MoveIt configuration using MoveItConfigsBuilder moveit_config = ( MoveItConfigsBuilder("robot_moveit_config", package_name="robot_moveit_config") .robot_description( - file_path="config/r5a_v_ros.urdf.xacro", mappings={"use_sim_time": "true"} + file_path=xacro_file, mappings={"use_sim_time": "true"} ) .robot_description_semantic("config/armr5.srdf") .robot_description_kinematics("config/kinematics.yaml")