Robotics StackExchange | Archived questions

How to set physics engine in Gazebo through ROS

I was researching the physics engines available for Gazebo and wanted to try other then default engine. In those slides, it says, that you can define what engine to use in the world file. In form

<world><physics type=”simbody” />...

I found this in my world file that was created in Gazebo client

<physics name='default_physics' default='0' type='ode'>

If I rewrite the type to an nonexistent engine type and launch the world from ROS launch file, there is no error. If I rewrite it to 'simbody' or 'bullet', nothing changes. The simulation in all the cases starts with the ode engine. If I start Gazebo client with commands

rosrun gazebo_ros gazebo --verbose -e bullet

or

rosrun gazebo_ros gazebo --verbose -e simbody

the physics engine does correspond to the given type. So how can I do it within the world file?

Asked by kumpakri on 2018-10-12 09:00:49 UTC

Comments

Answers

If I rewrite the type to an nonexistent engine type and launch the world from ROS launch file, there is no error. If I rewrite it to 'simbody' or 'bullet', nothing changes. The simulation in all the cases starts with the ode engine.

Have you tried removing the default="0"? You can read more about physics profiles here.

Asked by chapulina on 2018-10-12 09:49:11 UTC

Comments

That is a good point. But even though I put default="1" type="simbody" in there, it loads ODE.

Asked by kumpakri on 2018-10-15 03:59:49 UTC

How are you checking which physics engine is being loaded, through the GUI?

Asked by chapulina on 2018-10-15 14:37:20 UTC

I check the engine type in the physics tab in the loaded gazebo client.

Asked by kumpakri on 2018-10-15 14:56:29 UTC

That's strange, it works for me. Do you get the correct engine if you load the world without passing through ROS? Maybe gazebo_ros_pkgs is overriding the value in the world file.

Asked by chapulina on 2018-10-15 15:05:50 UTC

You are right. I am always using the empty_world.launch from the gazebo_ros packgae to run the Gazebo from ROS launch files. This launch file defines the default physics engine to be the ode, so if I don't add the physics argument to the parameters of gazebo world, the ode engine will load no matter what I set in the world sdf file. In order for the physics type setting in the WORLD file to work, the -e $(arg physics) argument in the gzserver node launching tags needs to be removed.

Asked by kumpakri on 2019-08-16 11:08:51 UTC

What did you end up changing in your launch file to make it work?

Asked by Rellum on 2022-09-09 04:37:14 UTC