I am using Isaac Gym for rope simulation where the rope model is a series of connected bodies with spherical joints, and I try to print the velocity of the body (or the link) by using the function ‘get_actor_rigid_body_states()’. However, from the visualization and the printed position information I can confirm two end bodies of the rope are manipulated to be hung statically in the air by constantly applying a spring-damping force, the velocity of the first end body is non-zero, and looks quite large numbers (~0.4m/s on the x-axis) which is not correct. I wonder if there is any incorrect operation I did? When there is no force applied and only gravity, the rope will fall down to the ground and the velocity is correct to be around zero.
In two figures, one is the rendered rope which keeps static for long enough, the second is the printed velocities, positions, and applied force to the first body of the rope, where the positions stay almost the same, but the velocities are quite large to be apparently incorrect.
TL;DR printed velocities are inconsistent according to printed positions between each frame and the visualization after applying force.
Thank you in advance for any possible help or idea on solving this problem.
start with only four links and check if this problem goes away, if it does, it’s probably because of the large number of joints. I’m wondering how you you added spherical joints? I couldn’t find them in the documents. Are you putting 3 revolute joints together to make a spherical one?
Another guess is that the solver is not converging to a solution! what’s the simulation step length? how many sub steps?
I simply apply a PD controller to drag the end of the rope to a certain position in the air, what’s interesting is that with such PD controller where the velocity is non-zero, the rope can actually stay statically.
I see! reduce the dt to maybe 0.001 and increase the sub steps to see if it makes any difference.
Another thing you can try is that instead of using a position controller for holding the both ends of the rope, fix one end of the rope which I guess would be the base link using this:
asset_options.fix_base_link = True
And fix the other end using your position controller, see if it works or not.
also use smaller value for Kp(stiffness) and higher value for Kd(damping), it should help…
No problem! I see! I’m guessing it’s due to the large number of links or the solver is not converging, in Matlab Simscape you can see if the simulation is stock and it’s not converging but here you can’t see it. What do you get from calculating the derivative of the position? is it equal to the velocity?
Using PhysX might not be the best way to simulate a flexible thing like a rope, you should use Flex as it’s designed for such purpose. Have you tried that?
Really thanks for your help. Actually, I made a very silly mistake. I should use an attractor instead of manually applying a PD controller to the rope. When I use attractor, the problem of incorrect velocities can be solved well.
Thanks for sharing how you resolved it, very interesting! so for controlling the position, speed and acceleration of bodies we should use attractors instead of applying direct force to them.
Did you try Flex btw?
I didn’t try Flex yet, though Flex provides a good implementation for softbody like 3D soft objects. I’ll probably try it after I finish my current project.
In the example folder of isaacgym, there is actually a demo code “franka_attractor.py” providing how to use attractors which function exactly the same as applying spring-damper force to it, but much more stable than manually applying the force since the velocity is more accurate.