launch Gazebo from ROS2

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

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 empty_world.launch.py 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 empty_world.launch.py 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: https://answers.ros.org/question/3149...

  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

Comments

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

sloretz gravatar imagesloretz ( 2019-08-26 15:28:02 -0600 )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. spawn_entity_demo.launch.py 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 imagemogumbo ( 2019-08-26 16:12:15 -0600 )edit
1

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

mogumbo gravatar imagemogumbo ( 2019-08-26 17:13:56 -0600 )edit