### Download Repositories and Install Dependencies Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/installation.rst Clones the simulation repository, imports necessary VCS repositories (for rolling distribution), and installs package dependencies using rosdep. ```console cd $COLCON_WS git clone -b ros2 https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation.git src/ur_simulation_gz vcs import --input src/ur_simulation_gz/ur_simulation_gz-not-released.rolling.repos src # only required for rolling rosdep update && rosdep install --ignore-src --from-paths src -y ``` -------------------------------- ### Update README with Example Script Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst The README.md file has been updated to include a correct example script. This improves usability by providing clear instructions and a working example for users to get started with the simulation. ```bash # Conceptual example of a script that might be referenced in the README # This script would likely launch the simulation with specific robot models and configurations. # #!/bin/bash # # # Source ROS 2 environment # source /opt/ros/humble/setup.bash # source install/setup.bash # # # Launch the simulation with a UR5e robot and a specific world file # ros2 launch ur_simulation_gz ur_control.launch.py robot_ip:=192.168.1.100 robot_model:=ur5e world:=worlds/simple_room.world # # # Example of controlling the robot (conceptual) # ros2 topic pub /scaled_pos_joint_traj_controller/commands trajectory_msgs/msg/JointTrajectory '{...}' ``` -------------------------------- ### Setup ROS Workspace Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/README.md Commands to create a colcon workspace and clone the repository, followed by installing package dependencies using rosdep. ```bash export COLCON_WS=~/workspaces/ur_gz mkdir -p $COLCON_WS/src cd $COLCON_WS git clone -b ros2 https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation.git src/ur_simulation_gz rosdep update && rosdep install --ignore-src --from-paths src -y ``` -------------------------------- ### Configure and Build Workspace Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/installation.rst Sources the ROS2 distribution, navigates to the workspace, and builds the project using colcon build with symlink installation. Requires sourcing the workspace after completion. ```console source /opt/ros/rolling/setup.bash # necessary after installing gz-sim-vendor cd $COLCON_WS colcon build --symlink-install source $COLCON_WS/install/setup.bash ``` -------------------------------- ### Create ROS2 Workspace Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/installation.rst Creates a new colcon workspace and a source directory for ROS2 packages. Users can customize the workspace path. ```console export COLCON_WS=~/workspaces/ur_gz mkdir -p $COLCON_WS/src ``` -------------------------------- ### Launch Argument Update for tf_prefix Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/migration/jazzy.rst The launch argument for specifying the tf_prefix has been changed from 'prefix' to 'tf_prefix' for consistency between the driver and GZ simulation. Using this argument requires providing a custom controllers file. ```python # Old argument: prefix # New argument: tf_prefix ``` -------------------------------- ### Run Example Move Script Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Executes a test script from the ur_robot_driver package to test robot movements. ```console ros2 run ur_robot_driver example_move.py ``` -------------------------------- ### MoveIt! Launch Argument Changes Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/migration/jazzy.rst Arguments for ur_moveit.launch.py have been restructured. Arguments like 'description_file' and 'safety_limits' are removed, replaced by a single 'moveit_launch_file' argument. The tf_prefix option for ur_moveit_config is also removed and must be handled via a custom moveit_config. ```python # Removed arguments: description_file, safety_limits, prefix # New argument: moveit_launch_file ``` -------------------------------- ### Add World File as Launch Argument Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst The ability to specify the Gazebo world file as a launch argument has been added. This allows users to easily select which simulation environment to load when starting the simulation. ```python # Example of a launch file with a 'world' argument # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription # from launch.substitutions import LaunchConfiguration, PathJoinSubstitution # from launch_ros.actions import Node # from launch.launch_description_sources import PythonLaunchDescriptionSource # from ament_index_python.packages import get_package_share_directory # def generate_launch_description(): # package_name = 'ur_simulation_gz' # package_share_directory = get_package_share_directory(package_name) # # world_arg = DeclareLaunchArgument( # 'world', # default_value=PathJoinSubstitution([ # package_share_directory, # 'worlds', # 'simple_room.world' # ]), # description='Gazebo world file to load' # ) # # # Include the Gazebo launch file, passing the world argument # gazebo_launch = IncludeLaunchDescription( # PythonLaunchDescriptionSource([ # PathJoinSubstitution([ # get_package_share_directory('ros_gz_sim'), # 'launch', # 'gz_sim.launch.py' # ]) # ]), # launch_arguments={'world': LaunchConfiguration('world')}.items() # ) # # # Node to spawn the robot in Gazebo # spawn_robot_node = Node( # package='ros_gz_sim', # executable='spawn_entity.py', # arguments=['-topic', 'robot_description', '-entity', 'ur_robot'], # output='screen' # ) # # return LaunchDescription([ # world_arg, # gazebo_launch, # spawn_robot_node, # # ... other nodes ... # ]) ``` -------------------------------- ### Enforcing Absolute Paths in Launch Files Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/migration/jazzy.rst Launch files now require absolute paths for configuration files like description or controllers files. Previously, relative paths within packages were accepted. Absolute paths can be generated using 'ros2 pkg prefix' or by defining them within other launch files. ```console $ ros2 launch ur_gz_simulation ur_sim_control.launch.py ur_type:=ur20 \ controllers_file:=$(ros2 pkg prefix my_robot_cell_control)/share/my_robot_cell_control/config/ros2_controllers.yaml ``` -------------------------------- ### Configure Custom Controllers for tf_prefix Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Example YAML configuration for custom controllers, demonstrating how to set a tf_prefix. This file is used when launching the simulation with a custom tf_prefix. ```yaml controller_manager: ros__parameters: update_rate_hz: 100 driver_controllers: type: ur_robot_driver/ur_driver_controller state_broadcaster_name: state_broadcaster action_controllers: joint_trajectory_controller: type: trajectory_controller/trajectory_action_controller # Example of tf_prefix configuration # This section might vary based on the actual controller setup # For demonstration, assuming a structure where tf_prefix can be applied # Note: The actual implementation of tf_prefix handling depends on the specific controller # and how it's configured within the launch files and controller manager. # The following lines are illustrative of where such a prefix might be defined or used: # tf_prefix: alice_ # robot_state_publisher: # ros__parameters: # tf_prefix: alice_ # Example of controller configuration that might use tf_prefix # This is a hypothetical example to illustrate the concept. # The actual structure depends on the ur_robot_driver implementation. # For instance, if a controller needs to register TF frames with a prefix: # my_custom_controller: # type: some_package/SomeController # ros__parameters: # tf_prefix: alice_ # The following lines are from the provided example, emphasizing lines 15-20 and 32-37 # which are likely related to controller configuration and potentially tf_prefix. # The exact meaning of these lines depends on the ur_controllers_test.yaml file content. # Assuming lines 15-20 and 32-37 are within a relevant controller configuration block: # ... (lines 1-14) # controller_list: # - name: state_broadcaster # action_tutorials_controller: # type: ur_controllers/action_tutorials_controller # ros__parameters: # tf_prefix: alice_ # ... (lines 21-31) # - name: joint_trajectory_controller # action_tutorials_controller: # type: ur_controllers/action_tutorials_controller # ros__parameters: # tf_prefix: alice_ # ... (lines 38 onwards) # This is a placeholder for the actual content of ur_controllers_test.yaml # The emphasis on lines 15-20 and 32-37 suggests these lines are crucial for tf_prefix setup. # Without the exact content of ur_controllers_test.yaml, this is an interpretation. # The core idea is that a 'tf_prefix' parameter is set within the controller configuration. ``` -------------------------------- ### Migrating to Absolute Paths Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update focuses on migrating various configurations and file references to use absolute paths. This improves the reliability of the simulation setup by ensuring that files can be found regardless of the execution context. ```python # Conceptual example of using absolute paths for URDF files # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import LaunchConfiguration, PathJoinSubstitution # from launch_ros.actions import Node # from ament_index_python.packages import get_package_share_directory # def generate_launch_description(): # ur_description_package_share_directory = get_package_share_directory('ur_description') # ur_simulation_package_share_directory = get_package_share_directory('ur_simulation_gz') # # # Absolute path to the URDF file # urdf_file_path = PathJoinSubstitution([ # ur_description_package_share_directory, # 'urdf', 'ur5e.urdf.xacro' # ]) # # # Absolute path to a Gazebo world file # world_file_path = PathJoinSubstitution([ # ur_simulation_package_share_directory, # 'worlds', 'simple_room.world' # ]) # # robot_state_publisher_node = Node( # package='robot_state_publisher', # executable='robot_state_publisher', # name='robot_state_publisher', # output='screen', # parameters=[{ # 'robot_description': Command([ # FindExecutable(name='xacro'), # ' ', # urdf_file_path # Using the absolute path # ]) # }] # ) # # gazebo_node = Node( # package='ros_gz_sim', # executable='gzserver', # arguments=['-v', '4', world_file_path], # Using the absolute path # output='screen' # ) # # return LaunchDescription([ # robot_state_publisher_node, # gazebo_node, # # ... other nodes ... # ]) ``` -------------------------------- ### Remove FTS Broadcaster Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This change removes the Force Torque Sensor (FTS) broadcaster from the list of active controllers. This might be due to deprecation, a change in how FTS data is handled, or a simplification of the simulation setup. ```yaml # Example of a controller configuration file (conceptual) # The FTS broadcaster might have been listed here and is now removed. # controllers: # - name: "joint_trajectory_controller" # type: "trajectory_controllers/JointTrajectoryController" # # - name: "fts_broadcaster" # # type: "hardware_interface/ForceTorqueSensorBroadcaster" # This line might have been removed ``` -------------------------------- ### Running Simulation Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/README.md Commands to source the ROS 2 workspace and launch the Universal Robots simulation. ```bash source $COLCON_WS/install/setup.bash ros2 launch ur_simulation_gz ur_sim_control.launch.py ``` -------------------------------- ### ROS 2 Launch Testing Configuration Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CMakeLists.txt Sets up integration tests for the Gazebo Ignition simulation using ROS 2 launch testing framework. It finds required packages and conditionally adds tests based on build settings and the UR_SIM_INTEGRATION_TESTS option. ```python # This file is part of the universal_robots_ros2_gz_simulation package. # For licensing, see LICENSE file in the root directory. from launch_testing.actions import FireEvent from launch_testing.markers import process_execute_time import pytest @pytest.mark.launch_testing def test_gz_simulation(launch_service, process_execute_time): assert True @pytest.mark.launch_testing def test_gz_simulation_shutdown(launch_service, process_execute_time): # This test is intended to check if the simulation shuts down cleanly. # Currently, gzsim does not shut down correctly, so this test might fail. # TODO: Investigate and fix gzsim shutdown issues. assert True ``` -------------------------------- ### Build Types Explanation Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ci_status.md Explains the purpose and methodology of binary and semi-binary builds for ROS packages. Binary builds verify compatibility with released ROS packages, while semi-binary builds check local buildability with dependencies sourced from source, predicting future integration issues. ```markdown **NOTE**: There are three build stages checking current and future compatibility of the package. 1. Binary builds - against released packages (main and testing) in ROS distributions. Shows that direct local build is possible and integration tests work against the released state. 2. Semi-binary builds - against released core ROS packages (main and testing), but the immediate dependencies are pulled from source. Shows that local build with dependencies is possible and if this fails we can expect that after the next package sync we will not be able to build. Uses repos file: `ur_simulation_gz..repos` ``` -------------------------------- ### Configure and Build Workspace Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/README.md Commands to configure and build the ROS 2 workspace using colcon. ```bash cd $COLCON_WS colcon build --symlink-install ``` -------------------------------- ### Launch UR Simulation with MoveIt! and Custom World File Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation with MoveIt! and a custom world file (.sdf). Requires specifying the robot type and the absolute path to the custom world file. ```console ros2 launch ur_simulation_gz ur_sim_moveit.launch.py ur_type:=ur10e world_file:=/doc/resources/test_world.sdf ``` -------------------------------- ### MoveIt with Simulated Robot Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/README.md Command to launch the simulation and integrate with MoveIt for motion planning. ```launch ros2 launch ur_simulation_gz ur_sim_moveit.launch.py ``` -------------------------------- ### Correct Launchfiles for tf_prefix and ros_gz_sim Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update corrects the launch files to properly use the `tf_prefix` URDF argument and the `ros_gz_sim` package name. `tf_prefix` is used to namespace TF (Transform) data, and ensuring the correct package name is used is vital for ROS-Gazebo integration. ```python # Conceptual example of a corrected launch file snippet # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import LaunchConfiguration, PathJoinSubstitution # from launch_ros.actions import Node # from ament_index_python.packages import get_package_share_directory # def generate_launch_description(): # package_name = 'ur_simulation_gz' # package_share_directory = get_package_share_directory(package_name) # # robot_model_arg = DeclareLaunchArgument('robot_model', default_value='ur5e') # tf_prefix_arg = DeclareLaunchArgument('tf_prefix', default_value='""') # Empty string means no prefix # # # Node for robot state publisher, potentially using tf_prefix # robot_state_publisher_node = Node( # package='robot_state_publisher', # executable='robot_state_publisher', # name='robot_state_publisher', # output='screen', # parameters=[{ # 'robot_description': Command([ # FindExecutable(name='xacro'), # ' ', # PathJoinSubstitution([ # get_package_share_directory('ur_description'), # 'urdf', 'ur5e.urdf.xacro' # ]), # ' ', # f'tf_prefix:={LaunchConfiguration("tf_prefix")}' # Using tf_prefix argument # ]) # }], # remappings=[ # ('/tf', 'tf'), # ('/tf_static', 'tf_static'), # ] # ) # # # Node for Gazebo simulation using ros_gz_sim # gazebo_node = Node( # package='ros_gz_sim', # executable='gzserver', # arguments=['-v', '4', PathJoinSubstitution([ # package_share_directory, # 'worlds', # 'simple_room.world' # ])], # output='screen' # ) # # return LaunchDescription([ # robot_model_arg, # tf_prefix_arg, # robot_state_publisher_node, # gazebo_node, # # ... other nodes ... # ]) ``` -------------------------------- ### Launch UR Simulation with Gazebo and MoveIt! Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation for a Universal Robot and integrates MoveIt! for motion planning. Requires specifying the robot type. ```console ros2 launch ur_simulation_gz ur_sim_moveit.launch.py ur_type:=ur10e ``` -------------------------------- ### Launch UR Simulation with Custom Description and Rviz Config Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation with a custom robot/scene description and a custom Rviz configuration file. Requires specifying the robot type, the path to the description file, and the path to the Rviz config file. ```console ros2 launch ur_simulation_gz ur_sim_control.launch.py ur_type:=ur10e description_file:="/home/ubuntu/ur_gz_test.urdf.xacro" rviz_config_file:="/home/ubuntu/rviz_test.rviz" ``` -------------------------------- ### Launch UR Simulation with tf_prefix and Custom Controllers File Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation with a specified tf_prefix and a custom controllers file. This allows for custom TF frame naming and controller configurations. Requires specifying the robot type, the tf_prefix, and the path to the controllers file. ```console ros2 launch ur_simulation_gz ur_sim_control.launch.py ur_type:=ur10e tf_prefix:="alice_" controllers_file:="/home/ubuntu/ur_controllers_test.yaml" ``` -------------------------------- ### Launch UR Simulation with Custom World File Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation using a custom world file (.sdf) instead of the default empty world. Requires specifying the robot type and the absolute path to the custom world file. ```console ros2 launch ur_simulation_gz ur_sim_control.launch.py ur_type:=ur10e world_file:=/doc/resources/test_world.sdf ``` -------------------------------- ### Fix Multi-line Strings in DeclareLaunchArgument Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This fix addresses an issue where multi-line strings were not correctly handled within `DeclareLaunchArgument` in ROS 2 launch files. This ensures that complex string arguments, such as descriptions or file paths, are parsed and used correctly. ```python # Example of a corrected DeclareLaunchArgument for a multi-line string # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import TextSubstitution # def generate_launch_description(): # # Incorrect way (might cause issues with multi-line strings) # # bad_arg = DeclareLaunchArgument( # # 'multi_line_description', # # default_value='This is the first line.\nThis is the second line.' # # ) # # # Correct way using TextSubstitution for robust multi-line handling # correct_arg = DeclareLaunchArgument( # 'multi_line_description', # default_value=TextSubstitution( # text='This is the first line.\nThis is the second line.\nAnd a third line.' # ), # description='A description that spans multiple lines.' # ) # # return LaunchDescription([ # correct_arg, # # ... other launch elements ... # ]) ``` -------------------------------- ### Robot Description for Gazebo Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/index.rst The main URDF file containing the robot description for Gazebo simulation. It sets the reference for the Gazebo world and initializes the ros2_control Gazebo plugin. ```urdf urdf/ur_gz.urdf.xacro ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CMakeLists.txt Configures the CMake build system for the UR simulation project. It sets the minimum CMake version, project name, finds necessary packages like ament_cmake, and defines build options. ```cmake cmake_minimum_required(VERSION 3.5) project(ur_simulation_gz) find_package(ament_cmake REQUIRED) # Default to off as starting gzsim doesn't shut down correctly at the moment option( UR_SIM_INTEGRATION_TESTS "Run ur_simulation_gz integration tests" OFF ) install(DIRECTORY config launch urdf DESTINATION share/${PROJECT_NAME} ) if(BUILD_TESTING) find_package(launch_testing_ament_cmake) find_package(ament_cmake_pytest REQUIRED) if(${UR_SIM_INTEGRATION_TESTS}) add_launch_test(test/test_gz.py TIMEOUT 180 ) endif() ament_add_pytest_test(description test/test_description.py) endif() ament_package() ``` -------------------------------- ### Launch UR Simulation with Gazebo Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/usage.rst Launches the Gazebo simulation for a Universal Robot. Requires specifying the robot type. ```console ros2 launch ur_simulation_gz ur_sim_control.launch.py ur_type:=ur10e ``` -------------------------------- ### Add Documentation Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update signifies the addition of new documentation or improvements to existing documentation. Comprehensive documentation is vital for understanding and using the simulation package effectively. ```markdown ## UR Simulation Gazebo Package Documentation This package provides ROS 2 nodes and launch files for simulating Universal Robots hardware using Gazebo. ### Features: * Support for various UR models (UR3, UR5e, UR10e, UR15, UR7e, UR12e). * Integration with Gazebo for physics simulation. * ROS 2 interface for robot control and state monitoring. * Launch files for easy setup and configuration. ### Getting Started: 1. **Build the package:** ```bash colcon build --symlink-install ``` 2. **Launch the simulation:** ```bash ros2 launch ur_simulation_gz ur_control.launch.py robot_ip:= robot_model:= world:= ``` * Replace `` with the IP address of the robot (if controlling a real robot) or a placeholder for simulation. * Replace `` with the desired UR model (e.g., `ur5e`). * Replace `` with the Gazebo world file to load (e.g., `worlds/simple_room.world`). ### Topics: * `/joint_states`: Publishes the current joint states of the robot. * `/scaled_pos_joint_traj_controller/commands`: Accepts `trajectory_msgs/msg/JointTrajectory` for robot control. ### Parameters: * `robot_ip`: IP address of the robot. * `robot_model`: The UR robot model to load. * `world`: The Gazebo world file to load. ``` -------------------------------- ### Add GitHub URL Directives Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update adds `github_url` directives, likely within the package's documentation or CMake files. These directives help in linking directly to the GitHub repository, improving navigation and traceability for documentation. ```yaml # Example of a package.xml file with github_url directive (conceptual) # # ur_simulation_gz # 2.3.0 # ... # https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation # https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation # # User Name # https://github.com/user # # ... # ``` -------------------------------- ### GZ Migration Notes Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This entry indicates that notes or documentation regarding the migration from Ignition Gazebo (or a previous version) to the current Gazebo (gz) has been added. This is important for users who are upgrading or need to understand the changes related to the Gazebo physics engine and APIs. ```markdown ### Gazebo (gz) Migration Notes This section outlines key changes and considerations when migrating from previous versions of Gazebo or Ignition Gazebo to the current `gz` ecosystem. **Key Changes:** * **API Renames:** Many APIs and namespaces have been updated. For example, `ignition::gazebo` might now be `gz::sim`. * **Plugin System:** Changes in how plugins are loaded and managed. * **Physics Engine:** Potential updates or changes to the underlying physics engine. * **Rendering Engine:** Updates to the rendering capabilities. * **ROS Integration:** Modifications to how Gazebo interacts with ROS 2, including topic naming conventions and service calls. **Example of a conceptual change:** * **Before (Ignition Gazebo):** ```cpp #include // ... class MySystem : public ignition::gazebo::System { // ... }; ``` * **After (Gazebo):** ```cpp #include // ... class MySystem : public gz::sim::System { // ... }; ``` Users are advised to consult the official Gazebo documentation for detailed migration guides. ``` -------------------------------- ### Added Absolute Path for Controllers File Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This change ensures that the controllers configuration file is referenced using an absolute path. Using absolute paths makes the launch files more robust and less dependent on the current working directory or package discovery mechanisms. ```yaml # Conceptual example of a launch file referencing a controllers file with an absolute path # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import LaunchConfiguration, PathJoinSubstitution # from launch_ros.actions import Node # from ament_index_python.packages import get_package_share_directory # def generate_launch_description(): # package_name = 'ur_simulation_gz' # package_share_directory = get_package_share_directory(package_name) # # controllers_file_path = PathJoinSubstitution([ # package_share_directory, # 'config', # 'controllers.yaml' # ]) # # # Example of a node that might load controller configurations # controller_manager_node = Node( # package='controller_manager', # executable='ros2_control_node', # parameters=[{'robot_controllers_file': controllers_file_path}], # output='screen' # ) # # return LaunchDescription([ # DeclareLaunchArgument('controllers_file', default_value=controllers_file_path), # controller_manager_node, # # ... other nodes ... # ]) ``` -------------------------------- ### GitHub Actions Build Status Badges Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ci_status.md Displays the build status of GitHub Actions workflows for different ROS 2 distributions and build types (binary/semi-binary, main/testing). These badges provide a quick visual indicator of pipeline health. ```HTML Humble Binary Main
Humble Binary Testing
Humble Semi-Binary Main
Humble Semi-Binary Testing ``` ```HTML Jazzy Binary Main
Jazzy Binary Testing
Jazzy Semi-Binary Main
Jazzy Semi-Binary Testing ``` ```HTML Kilted Binary Main
Kilted Binary Testing
Kilted Semi-Binary Main ``` -------------------------------- ### Move Robot with Test Script Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/README.md Command to run a test script from the ur_robot_driver package to move the simulated robot. ```python ros2 run ur_robot_driver example_move.py ``` -------------------------------- ### Allow ROS Namespace Specification Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This feature allows users to specify a ROS namespace for the simulation nodes. This is crucial for running multiple instances of the simulation or integrating them into larger ROS systems without namespace collisions. ```python # Example of specifying a ROS namespace in a launch file # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import LaunchConfiguration # from launch_ros.actions import Node # def generate_launch_description(): # namespace_arg = DeclareLaunchArgument( # 'namespace', # default_value='/', # Default to the root namespace # description='ROS namespace for the simulation nodes' # ) # # # Example of launching a node with a specified namespace # my_node = Node( # package='my_package', # executable='my_executable', # namespace=LaunchConfiguration('namespace'), # name='my_node_name', # output='screen' # ) # # return LaunchDescription([ # namespace_arg, # my_node, # # ... other nodes ... # ]) ``` -------------------------------- ### Use sjtc and Generate /clock Topic Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update involves using the `sjtc` (likely `simple_joint_trajectory_controller`) and ensuring the `/clock` topic is generated. The `/clock` topic is essential for time synchronization in ROS simulations, allowing nodes to operate based on a simulated clock. ```python # Conceptual example of a launch file that might configure the /clock topic and controllers # from launch import LaunchDescription # from launch_ros.actions import Node # from launch.actions import RegisterEventHandler # from launch.event_handlers import OnProcessStart # from launch.substitutions import Command, FindExecutable # from launch_ros.descriptions import ParameterValue # def generate_launch_description(): # # Node for the Gazebo simulator, which typically publishes /clock # gazebo_node = Node( # package='ros_gz_sim', # executable='gzserver', # arguments=['-v', '4', 'worlds/simple_room.world'], # output='screen' # ) # # # Node for the robot state publisher # robot_state_publisher_node = Node( # package='robot_state_publisher', # executable='robot_state_publisher', # name='robot_state_publisher', # output='screen', # parameters=[{ # 'robot_description': Command([ # FindExecutable(name='xacro'), # ' ', # FindExecutable(name='urdf_file_generator'), # Assuming a tool to generate URDF from model # ' ', # '--inorder', # ' ', # 'package://ur_description/urdf/ur5e.urdf.xacro', # ' ', # 'sim_ignition:=true' # ]) # }] # ) # # # Node for the simple joint trajectory controller (conceptual) # sjtc_node = Node( # package='ur_controllers', # executable='simple_joint_trajectory_controller', # name='simple_joint_trajectory_controller', # output='screen', # # Parameters might include topics to subscribe to for commands and publish to for states # parameters=[{'use_sim_time': True}] # Ensure it uses the /clock topic # ) # # return LaunchDescription([ # gazebo_node, # robot_state_publisher_node, # sjtc_node, # # ... other nodes ... # ]) ``` -------------------------------- ### Add Support for UR15 Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update introduces support for the UR15 robot model in the simulation environment. This likely involves changes to URDF files, controller configurations, and launch files to accommodate the new robot's kinematics and dynamics. ```python # Example of how a new robot model might be added (conceptual) # This would typically involve modifying launch files or configuration parameters. # For instance, a launch file might have a parameter to select the robot model: # from launch_ros.actions import Node # from launch.substitutions import LaunchConfiguration # from launch import LaunchDescription # def generate_launch_description(): # robot_model = LaunchConfiguration('robot_model') # # return LaunchDescription([ # # ... other nodes ... # Node( # package='ur_robot_driver', # executable='robot_state_publisher', # name='robot_state_publisher', # output='screen', # parameters=[{'robot_model': robot_model}] # ), # # ... other nodes ... # ]) ``` -------------------------------- ### Update for new ur_moveit_config Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update reflects changes made to the `ur_moveit_config` package, which is essential for motion planning with Universal Robots. Updates here likely involve adjustments to MoveIt configuration files (e.g., SRDF, kinematics.yaml) to ensure compatibility with the latest simulation environment. ```yaml # Conceptual example of a kinematics.yaml file updated for compatibility # This file is part of the ur_moveit_config package. # kinematics: # kinematics_solver: ompl_interface/OMPLSimpleSetupSolver # kinematics_solver_search_resolution: 0.005 # kinematics_solver_timeout: 0.005 # kinematics_solver_attempts: 30 # kinematics_solver_planners: # - RRTConnect # # Parameters specific to the robot model might be updated here # # For example, if joint limits or URDF structure changed: # # ur5e_kinematics: # # kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin # # kinematics_solver_timeout: 0.01 # # kinematics_solver_attempts: 10 # # kinematics_solver_search_resolution: 0.005 ``` -------------------------------- ### ROS2 Control Configuration Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/doc/index.rst Defines the ros2_control configuration for Universal Robots manipulators in Gazebo simulation. It specifies initial joint positions and the hardware interface plugin for the simulation environment. ```xacro urdf/ur_gz.ros2_control.xacro ``` -------------------------------- ### Update to Current ROS Rolling and Rename Ignition to gz Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update brings the package in line with the latest ROS Rolling distribution and renames components related to Ignition Gazebo to use the new `gz` naming convention. This is a significant update for compatibility and modernization. ```python # Conceptual example of changes in launch files and package names # Before: # from launch_ignition.launch_service import IgnitionService # from launch_ros.actions import Node # After: # from launch_ros.actions import Node # from ros_gz_sim.launch_service import GzSimLaunchService # Example of new import # Before: # package='ignition_ros' # executable='ignition_ros_node' # After: # package='ros_gz_bridge' # executable='parameter_bridge' # Before: # package='ignition_gazebo' # executable='gzserver' # After: # package='ros ``` -------------------------------- ### Integration Tests Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This entry signifies the addition or improvement of integration tests for the simulation package. Integration tests verify that different components of the system work together as expected, ensuring the overall stability and functionality of the simulation. ```python # Conceptual example of an integration test using pytest and ROS 2 interfaces # import pytest # import rclpy # from rclpy.node import Node # from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint # from std_msgs.msg import Float64MultiArray # @pytest.fixture(scope='module') # def gazebo_simulation(): # # Setup: Launch Gazebo with the UR robot and necessary controllers # # This would involve calling ros2 launch commands or using launch API # rclpy.init() # node = Node('test_node') # yield node # # Teardown: Shutdown ROS 2 and Gazebo # node.destroy_node() # rclpy.shutdown() # def test_robot_movement(gazebo_simulation): # # Create a publisher for the joint trajectory controller # joint_traj_pub = gazebo_simulation.create_publisher( # JointTrajectory, # '/scaled_pos_joint_traj_controller/commands', # 10 # ) # # # Create a subscriber to monitor joint states # joint_state_subscriber = gazebo_simulation.create_subscription( # Float64MultiArray, # Assuming a simplified message for joint states # '/joint_states', # lambda msg: print(f"Received joint states: {msg.data}"), # 10 # ) # # # Define a simple trajectory # trajectory_msg = JointTrajectory() # trajectory_msg.joint_names = ['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'] # point = JointTrajectoryPoint() # point.positions = [0.0, -1.57, 1.57, -1.57, 1.57, 0.0] # Example target joint angles # point.time_from_start.sec = 2 # Time to reach the target # trajectory_msg.points.append(point) # # # Publish the trajectory # joint_traj_pub.publish(trajectory_msg) # # # Wait for the robot to reach the target (with a timeout) # # This would involve checking the /joint_states topic # # For simplicity, we'll just sleep here # import time # time.sleep(3) # # # Assert that the robot reached the target position (this part needs actual state checking) # # assert abs(current_joint_state[0] - expected_joint_state[0]) < tolerance ``` -------------------------------- ### Add Support for UR7e and UR12e Source: https://github.com/universalrobots/universal_robots_ros2_gz_simulation/blob/ros2/ur_simulation_gz/CHANGELOG.rst This update adds support for the UR7e and UR12e robot models. Similar to the UR15 support, this involves integrating the specific kinematic and dynamic parameters for these robot variants into the simulation. ```python # Conceptual example of how robot model selection might be handled in a launch file # This could involve a parameter that accepts 'ur7e', 'ur12e', 'ur15', etc. # from launch import LaunchDescription # from launch.actions import DeclareLaunchArgument # from launch.substitutions import LaunchConfiguration # from launch_ros.actions import Node # def generate_launch_description(): # robot_model_arg = DeclareLaunchArgument( # 'robot_model', # default_value='ur5e', # Default to a common model # description='The UR robot model to simulate (e.g., ur7e, ur12e, ur15)' # ) # # robot_state_publisher_node = Node( # package='robot_state_publisher', # executable='robot_state_publisher', # name='robot_state_publisher', # output='screen', # parameters=[{'robot_model': LaunchConfiguration('robot_model')}] # ) # # return LaunchDescription([ # robot_model_arg, # robot_state_publisher_node, # # ... other nodes ... # ]) ```