`apply_body_force` generates very different effects depending on `use_gpu_pipeline` is True or False

Hi,

I am playing around with the example scripts in Isaac Gym. I saw the example of apply_force.py which uses gym.apply_rigid_body_force_tensor, and it works well. From my understanding, this function will apply the force on all bodies in the environment and the force applied to each body is specified by the force_tensor. I wonder how to apply force to a particular body. I tried gym.apply_body_force. However, this function seems to give very different results depending on whether I turned on use_gpu_pipeline or not. When I am not using the gpu_pipeline, the simulation seems to be correct. But when I turned it on, the simulation seems to be giving wrong results.

My script is attached here.

In the script, I tried to apply a force that’s roughly equal to the object weight. So I expect to see that the object is roughly floating in the air. When I do not use gpu_pipeline, I do see such results. But when I turned on gpu_pipeline, the body just flies away pretty quickly. And in this case, when I instead apply a 0 force on the body, it falls very slowly (acceleration is smaller than g).

I am also not super sure about the param4 (position that force is applied at) in the function apply_body_force, is it in the global frame of each environment or in the body (the one on which the force is applied) coordinate frame. How can I make sure the force is always applied on the body center so that no torque is generated (seems like I need to get the body pos first every time I apply the force)?

I also wonder if there is a faster way to apply force on a specific body. The way I am doing now requires a for-loop, which may cost some time. What’s the best way to achieve this?

Thanks!

Hi @taocc,

We’ll have a look into your non-tensor based apply-force test, but in general we would definitely recommend using the tensor APIs.

If you want to apply forces to a limited number of objects with the tensor API, that’s quite straightforward - just alter your force tensor to apply zero force to objects you don’t want to change. For example, in the apply_force.py example, by default we set the force on all environments:

force[:, 0, force_axis] = 50.0  # apply force in force_axis direction on root

If you only want to apply that force to objects 0 through 4 you would do:

force[0:4, 0, force_axis] = 50.0  # apply force in force_axis direction on root

Take care,
-Gav

Hi Gav,

Thanks for your timely help. I tried out the solution you mentioned. However, it seems that the forces are not correctly applied either. I tried to apply an upward force that’s three times its weight. But the object moves up very slowly. I also tried to just apply 0 force on the body. Surprisingly, the object falls much slower if I apply a force that is 0. And if I comment out the line gym.apply_rigid_body_force_tensor(sim, force_tensor), the object falls in a correct acceleration.

I attached the new script here. Is there anything that I am doing wrong in the script? Thanks.

Hi Gav,

I wonder if you had a chance to take a look at this. Is what I am seeing after applying force expected in ISAAC Gym or is it I am missing some other commands?

Hi @taocc,

We’ve been able to reproduce the odd behavior you’ve reported and are looking into the details. We’ll post more info as we have it.

Take care,
-Gav

1 Like