Gravity compensation torque

I am developing a PD controller based on reinforcement learning using isaac gym.
Is there a way to get the gravity compensation torque for each joint of the robot arm?

To compute gravitational forces, you can follow these steps:

  1. Extract the masses

  2. Define the gravity vector

  3. Compute gravitational forces: Multiply each mass with the gravity vector to calculate the gravitational force acting on each object. The gravitational force F_gravity on an object with mass m and gravity. F_gravity = m * g.

To obtain torques for gravitational compensation, you can utilize linear Jacobian matrices. The steps involved are as follows:

  1. Extract the linear Jacobian matrices from the sim (gym.acquire_jacobian_tensor(sim, asset_name))

  2. Multiply with gravitational forces: Multiply the linear Jacobian matrices with the gravitational forces calculated in the previous step and sum them up. This results in a matrix of torques that represent the gravitational compensation required for each joint.

Alternatively, if you just want to train a PD controller on top of gravity compensation, you can turn off gravity for that asset (asset_options.disable_gravity = True ). This basically assumes perfect gravity compensation.

1 Like