Gazebo | Ignition | Community
Ask Your Question
0

How to change Physics Engine behaviour in Ignition or Classic?

asked 2020-11-05 07:48:25 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi everyone,

I would like to know how to modify in a certain way the Physics Engine (PE) in Ignition/Classic Gazebo. I'm particularly interested in collision computation, e.g. changing the object representation, collision detection, forces rendering, etc.

As far as I know, there are three possible ways to do this:

  1. Writing a physics plugin for Classic or Ignition. My question here is, can you actually modify the behaviour of the PE or is the API just meant for getting info from the PE and maybe set some "superficial" parameters, say the gravity vector or the friction coefficient for a given material/object?
  2. Modifying the PE itself. I guess that should be the optimal option because I'd have total freedom. Here, the question is if the following workflow is correct:

    • git clone both Gazebo and the PE.
    • Modify the PE as desired.
    • Somehow linking Gazebo CMakeLists.txt to my cloned PE repo?
    • Compile Gazebo
  3. As stated in an upcoming ign-physics tutorial, you can create new Features for each PE. The question is the same as no. 1.

If you can also provide a MWE, that would be awesome <3

Cheers,

mcres

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-12-18 14:02:21 -0500

claireyywang gravatar image

Hi, glad you looked at the tutorials. Here's the complete list for context https://github.com/ignitionrobotics/i...

  1. To answer your first question, the physics plugin is only an interface to physics engine and cannot modify physics engine behavior. To do that, you will need to modify the particular physics engine source code.
  2. To see how to link custom physics engine to ignition, you can follow the tutorial here https://github.com/ignitionrobotics/i.... Basically you will need to implement a physics engine API, and set it up following the example of TPE https://github.com/ignitionrobotics/i..., then write physics plugin feature for the physics engine.
  3. In the tutorial linked above, there is a minimum example focusing on EntityManagement feature in physics plugin and implementation in TPE.

Hope this helps

edit flag offensive delete link more
0

answered 2020-12-18 14:44:05 -0500

scpeters gravatar image

This is a big question! If you're willing to build the underlying physics engines from source, I think you can change just about anything. Here's a list of approaches you can take for osrf/gazebo (I will leave discussion of ignition for a follow-up post):

  1. To add functionality using the gazebo::physics APIs that are agnostic of physics engine, you can write a ModelPlugin or WorldPlugin. See the HarnessPlugin for example.

  2. You can also write plugins that are specific to certain physics engines if the gazebo::physics API is not enough. For example, the WheelSlipPlugin uses ODE slip parameters that aren't broadly exposed by the gazebo::physics API.

  3. To change the way Gazebo interfaces its gazebo::physics APIs with a physics engine, modify the files in the sub-folders like gazebo/physics/dart or gazebo/physics/bullet. For example, see some changes to support of kinematic loops in DART in bitbucket pull request 3086 merged in osrf/gazebo@bee69082.

  4. To modify the way a physics engine works, you can build it from source. The easiest example of this is by modifying our fork of Open Dynamics Engine in the deps/opende folder. For example see a modification of the Gearbox joint in our ODE fork in bitbucket pull request 3073 merged in osrf/gazebo@e11215a7. There are some old instructions for building the other physics engines from source using a catkin workspace, though I would now recommend using a colcon workspace.

  5. Adding or modifying the gazebo::physics API that is agnostic of physics engine is a bigger endeavor since it may require modifying the interfaces to all the supported physics engines.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-11-05 07:48:25 -0500

Seen: 381 times

Last updated: Dec 18 '20