Migrating Ignition gazebo_ros_pkgs/gazebo_package examples that launch scripts to ros_gz [closed]

asked 2023-01-22 19:15:14 -0500

RobotRoss gravatar image

updated 2023-04-05 18:54:21 -0500

Is there any documentation or advice giving guidance to migrating existing Ignition Gazebo examples to use ros_gz.

Sample 1) Gazebo Simulation (https://automaticaddison.com/set-up-t...) installs ros-humble-gazebo-ros_pkgs and a launch file includes this code, that uses the gazebo_ros_packages executables, as illustrated below..

-# Specify the actions

-# Start Gazebo server start_gazebo_server_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')), condition=IfCondition(use_simulator), launch_arguments={'world': world}.items())

X-Start Gazebo client
start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')), condition=IfCondition(PythonExpression([use_simulator, ' and not ', headless])))

Sample 2) Example of of a wheeled robot design, where the Gazebo-Classic Package gazebo_ros is used. This is an extract from its launch_sim.launch.py showing the part that launches Classic Gazebo:

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource

from launch_ros.actions import Node

def generate_launch_description():

[:launch robot_state_publisher, joystick, etc]

gazebo_params_file = os.path.join(get_package_share_directory(package_name),'config','gazebo_params.yaml')

# Include the Gazebo launch file, provided by the gazebo_ros package
gazebo = IncludeLaunchDescription(
                get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
                launch_arguments={'extra_gazebo_args': '--ros-args --params-file ' + gazebo_params_file}.items()

# Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot.
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
                    arguments=['-topic', 'robot_description',
                               '-entity', 'my_bot'],

A spawned node is started from the gazebo_ros package with executable “spawn_entity.py” .

Any suggested Gazebo Garden ros_gz code would replace the gzserver, gclient, and spawn_entity code?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by RobotRoss
close date 2023-06-22 11:06:33.033627


I believe the best answer is to follow the "ros_gz_project_template" repository procedure and work through migrating the Classic Gazebo "gazebo_ros_packages" to Gazebo Ignition Fortress and ros_gz . I'm closing this Question.

RobotRoss gravatar imageRobotRoss ( 2023-04-24 19:04:43 -0500 )edit