How to change physics engine for NRP


#1

Hi,

I am working on a robotic grasping experiment and would like to compare the collision effects of different physics engines. I tried to add a physics tag in the world file but it did not work:

<physics name="default_physics" default="0" type="bullet">
      <max_step_size>0.001</max_step_size>
      <real_time_factor>1</real_time_factor>
      <real_time_update_rate>-1</real_time_update_rate>
      <max_contacts>20</max_contacts>
 </physics>

When I open gazebo, the parameters change but the physics engine name is still ODE

Can anyone guide me how to correctly change it?

Many thanks,

Rui


#2

Hi,

You are right, this parameter is ignored, you can try adding this line in your .exc

bullet

if you grep for physicsEngine in $HBP/Experiments you will find quite some examples, which are using opensim but it will work for bullet as well.

Let me know if it worked, else we can debug a bit more.

Best regards,
Manos


#3

Hi, Manos,

Many thanks for your help and reply. I tested the demo experiment "1 DOF Myorobotics Arm for WP4 Cerebellum Experiment " (myoarm_small) and the experiment ran well with the physics engine OPENSIM.

However, when I changed the engine to “bullet” I got the following error:

Error Type

Unknown exception occured

Error Code

-1

Message

Error starting the simulation. (SimpleFacetValueError(<class ‘hbp_nrp_commons.generated.exp_conf_api_gen.PhysicsEngine’>, u’bullet’, <pyxb.binding.facets.CF_enumeration object at 0x7f0ef90ec6d0>)) (host: 172.19.0.3)

Stack Trace

l@http://localhost:9000/scripts/vendor.413b4582.js:74:4336
error@http://localhost:9000/scripts/vendor.413b4582.js:74:5484
controller@http://localhost:9000/scripts/vendor.413b4582.js:74:18940
g@http://localhost:9000/scripts/vendor.413b4582.js:4:23528
vb/this.$get</</<@http://localhost:9000/scripts/vendor.413b4582.js:5:18248
a.$get</j.open/k<@http://localhost:9000/scripts/vendor.413b4582.js:69:30091
h@http://localhost:9000/scripts/vendor.413b4582.js:6:8174
i/<@http://localhost:9000/scripts/vendor.413b4582.js:6:8347
$eval@http://localhost:9000/scripts/vendor.413b4582.js:6:15829
$digest@http://localhost:9000/scripts/vendor.413b4582.js:6:14302
$apply@http://localhost:9000/scripts/vendor.413b4582.js:6:16112
i@http://localhost:9000/scripts/vendor.413b4582.js:5:22536
u@http://localhost:9000/scripts/vendor.413b4582.js:5:24464
Kb/</x.onload@http://localhost:9000/scripts/vendor.413b4582.js:5:24937

Do you know what else should I change/implement for changing to the physics engine “bullet”?

Many thanks,

Rui


#4

Hi,

From what I see the bullet physics engine is not generally supported in the NRP, in the sense that it is not used in one of the existing experiments. But that does not prevent you from trying to use it, but from here on you are on your own. To allow the NRP to try to use bullet you can try the following:

cd $HBP/Experiments
open the ExDConfFile.xsd with an editor
find the line <xsd:enumeration value=“ode”/>
add the line <xsd:enumeration value=“bullet”/> below

cd $HBP/user-scripts
./regenerate_schemas

Then try to launch your simulation. Let me know how far you could go, and if it works out of the box we can consider adding bullet to the list of physics engines supported. It goes without saying that you need to have bullet installed either with apt (sudo apt install libbullet-dev), or from source. I hope it helps.

Best,
Manos


#5

Hi, Manos,

Thanks again for your reply. Still, it didn’t work. I tried to follow the steps and now the ExDConfFile.xsd looks like this:

  <!-- Supported physics engines -->
  <xsd:simpleType name="PhysicsEngine">
    <xsd:annotation>
      <xsd:documentation>This enumeration contains the physics engines supported by the NRP. This includes the stand$
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="ode"/>
      <xsd:enumeration value="bullet"/>
      <xsd:enumeration value="opensim"/>
    </xsd:restriction>
  </xsd:simpleType>

and I added the following line in my .exc file:

<physicsEngine>bullet</physicsEngine>

When I ran ./regenerate_schemas it reported several files has been overwritten. However, when I re-ran the experiment, I got the same error as above. :thinking:

Best regards,

Rui


#6

Hi,

Stupid question, but did you restart the cle from another terminal? Also, you could try to reclone your experiment. To see what might have gone wrong you can also replace line 34 in ~/.opt/bbp/nrp-services/gzserver with

–pause --verbose \

I tried changing the physics engine of a template experiment (holodeck husky) to bullet based on the following configuration by adding the line

<physicsEngine>bullet</physicsEngine>

after the tag
<cameraPose> . Careful cause the order of elements inthe .exc might break things. After doing this, restarting the cle, cloning the experiment it tried to launch it with bullet as physics engine. Of course it failed miserably cause all the plugins are ODE specific, but it tried to launch it with bullet. If your model and all the plugins are working with bullet there is a high chance they will work with the NRP as well, but no guarantees.

Best,
Manos


#7

Hi, Manos,

I am using the docker installation so I cannot see the verbose message of from the cle (or is there a method to show that?). After every modification I would restart the frontend and backend and also reclone my experiment. I also tried to change the line position of the <physicsEngine> tag but it seemed that it didn’t change anything.

Maybe I should find a computer with NRP local installation later and try again.

Best regards,

Rui


#8

Hi,

Thanks for the report, indeed as you say this scenario is more suitable for a source installation since you can modify everything on your computer and perform the necessary tests. The docker images are not supposed to be altered, and restarting a docker container means that all the changes that you do are lost. There is a docker way to apply the changes that we are talking about, but it is better to do everything in a source installation. Let me know how it went.

Best,
Manos