Difference between set_dof_actuation_force_tensor and set_actor_dof_position_targets

Hello. I have a question about controlling revolute joints in Isaac Gym. I have the following goal:

  • Control revolute joints to reach a target position (in radians).

I’ve identified two methods for achieving this goal:

  1. Using set_dof_actuation_force_tensor function
  • Calculate the torque required to reach the target position using the target position and gains (Kp and Kd).
  • The torque is calculated as follows: Torque = Kp * [target position - current position] - Kd * [current velocity].
  • Apply the calculated torque using the set_dof_actuation_force_tensor(sim, calculated torque) function.
  1. Using set_actor_dof_position_targets function
  • Directly set the target position using the set_actor_dof_position_targets(env, target position) function.

I’m wondering if there is a difference between these two methods, especially in terms of the motor (joint) stiffness and damping effects. If anyone has knowledge about this, please help me.

1 Like

hello. I was wondering the same thing, did you manage to solve it?

Hi @user138353, I was wondering if the function set_actor_dof_position_targets was working for you. In my case, even though I have non zero target positions, after I use the set_actor_dof_position_targets, the dofs’ position doesn’t change. See example below where there are two actors each having 6 DOFs :

dof positions targets :, tensor([[-0.1343, 0.0000, 0.0000, -0.1343, 0.0000, 0.0000],
[ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000]],
device=‘cuda:0’)
dof pos after step : tensor([[ 5.0412e-09, -4.2439e+00, 5.5635e-01, 3.5422e-04, 5.1129e+00,
-5.1128e+00],
[-4.1809e-09, -9.3297e-01, -3.4093e+00, 7.3326e-05, 4.3960e+00,
-1.5282e+00]], device=‘cuda:0’)

I made sure the dof are in position mode with “DOF_MODE_POS” set in the dof properties. This print is called after the simulation step. I’ve been struggling on this issue since four days so any suggestion or help will be highly appreciated !

Best

@margaria have you tried changing the stiffness and damping constants? here’s what I use for the kuka robot. It works pretty well:

robot_dof_properties["driveMode"][0:7].fill(gymapi.DOF_MODE_POS)
robot_dof_properties["stiffness"][:7].fill(1100.0)
robot_dof_properties["damping"][:7].fill(125.0)
1 Like

Hi @morganje,

I actually figured out there were several mistakes I made, one of them being a wrong dof parameter setting (including stiffness and damping that were both set to 0), so thank you for that !

I was also using the wrong function to set the desired target dof position. I was using set_actor_dof_velocity_targets while my DOF were in position control mode.

Thanks again for you help,
Best