Migrating Ignition gazebo_ros_pkgs/gazebo_package examples that launch scripts to ros_gz
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-the-odometry-for-a-simulated-mobile-robot-in-ros-2/) installs ros-humble-gazebo-rospkgs and a launch file includes this code, that uses the gazeboros_packages executables, as illustrated below..
-# Specify the actions
-# Start Gazebo server startgazeboservercmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(pkggazeboros, 'launch', 'gzserver.launch.py')), condition=IfCondition(usesimulator), launch_arguments={'world': world}.items())
X-Start Gazebo client
startgazeboclientcmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(pkggazeboros, 'launch', 'gzclient.launch.py')),
condition=IfCondition(PythonExpression([usesimulator, ' and not ', headless])))
Sample 2) Example of of a wheeled robot design, where the Gazebo-Classic Package gazeboros is used. This is an extract from its launchsim.launch.py showing the part that launches Classic Gazebo:
import os
from amentindexpython.packages import getpackageshare_directory
from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launchdescriptionsources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
def generatelaunchdescription():
[:launch robotstatepublisher, joystick, etc]
gazeboparamsfile = os.path.join(getpackagesharedirectory(packagename),'config','gazebo_params.yaml')
# Include the Gazebo launch file, provided by the gazebo_ros package
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
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'],
output='screen')
_________________________________________________________________________________________-
A spawned node is started from the gazeboros package with executable “spawnentity.py” .
Any suggested Gazebo Garden rosgz code would replace the gzserver, gclient, and spawnentity code?
Asked by RobotRoss on 2023-01-22 20:15:14 UTC
Comments
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.
Asked by RobotRoss on 2023-04-24 19:04:43 UTC