launch Gazebo from ROS2

asked 2019-07-16 15:56:45 -0500

mogumbo gravatar image

I want to be able to launch Gazebo from a ROS2 launch script, but I'm running into some trouble. The dashing branch of gazebo_ros has an script, but it's not fleshed out like the one in the ROS1 branches. I also see there are no scripts in the dashing branch, such as gzserver, debug, and gzclient.

When I tried to build my own I ran into a couple more problems:

  1. LaunchConfiguration('something') doesn't work for command line arguments if it returns an empty string. I haven't figured out what's going on behind the scenes yet, but I think it's this problem:

  2. Since the scripts are missing in the dashing branch, I don't see a way to set parameters when I launch gzserver or gzclient. I can launch them with launch.actions.ExecuteProcess(), but that doesn't appear to give you an option for setting parameters. launch_ros.actions.Node() gives you a parameters option, but I don't see how it can be used without scripts to act as nodes in the package.

So I guess my questions are: Is there a full-featured way to launch Gazebo from ROS2? Are the problems I listed above even relevant, or am I going about this the wrong way? Should I be filling up the launch and scripts directories with missing pieces and contributing them?

edit retag flag offensive close merge delete



It looks like there has been some work done in Dashing since this question was asked. The launch files,, and might now have the features you're looking for.

sloretz gravatar image sloretz  ( 2019-08-26 15:28:02 -0500 )edit

Thanks for pointing it out. I think this is a step in the right direction; I'll need to scrutinize it more after meetings. isn't working for me due to "unrecognized arguments: --ros-args", but I think that's a separate problem in launch_ros that someone is already working on.

mogumbo gravatar image mogumbo  ( 2019-08-26 16:12:15 -0500 )edit

After tinkering a bit, I'd consider this question to be answered. is the ROS2 version of ROS1's empty_world.launch.

mogumbo gravatar image mogumbo  ( 2019-08-26 17:13:56 -0500 )edit