Setting joint drive gains in python

Hi,

I initializing an articulation view in python like this:

leg_view = ArticulationView(prim_paths_expr="/World/Leg/MotorHousing", name="leg_view")
world.scene.add(leg_view)
world.initialize_physics()

And then using the set_…() functions like this:

leg_view.set_gains(kds=torch.full((1,num_motors), kd, device=world.device), kps=torch.full((1,num_motors),kp, device=world.device), joint_indices=[0,1])
leg_view.set_max_efforts(torch.full((1,num_motors), max_torque, device=world.device), joint_indices=[0,1])

leg_view.set_joint_position_targets(torch.full((1,num_motors), target), joint_indices=[0,1] )

But these changes are not reflected in the GUI (when I click on the joint in the stage panel and look at my drives, the default value is still shown). Am I doing something wrong?

Hi @finn.gross.maurer - The changes you’re making in your Python script are not reflected in the GUI because the GUI and the Python script are not synchronized. The GUI shows the initial values that were set when the scene was loaded, and it doesn’t update when you change these values in your Python script.

The ArticulationView object in your Python script and the GUI are two separate entities. When you change the properties of the ArticulationView object in your Python script, it doesn’t affect the GUI. Similarly, if you were to change the properties of the joint in the GUI, it wouldn’t affect the ArticulationView object in your Python script.

If you want to verify that your changes in the Python script are taking effect, you would need to do it programmatically.

Ok, thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.