Position control of a joint

I’m trying to do simple position control of a prismatic joint. If I do:

from omni.isaac.dynamic_control import _dynamic_control

dc = _dynamic_control.acquire_dynamic_control_interface()
articulation = dc.get_articulation("body")
dc.wake_up_articulation(articulation)
dof_ptr = dc.find_articulation_dof(articulation, "prismatic_joint")
dc.set_dof_position(dof_ptr, 1)

This works fine, but the joint position is influenced by gravity and so is not maintained.

If I do:

dc.set_dof_position_target(dof_ptr, 1)

The joint doesn’t move, presumably because I have not added a drive or controller. If I add a “Linear Drive” to the prismatic joint in the GUI, and then do the set_dof_position_target, the joint still doesn’t move.

What am I missing here? I just want to give the joint a target position and have it maintain that.

Thanks!

Not sure if this is relevant, but I’m seeing these warnings when I use UsdPhysics.ArticulationRootAPI.Apply(prim) to set the articulation root to the cuboid that has a fixed joint to the world.

The “/presenter/slider” mentioned is the cuboid that has the prismatic joint and which slides around when doing set_position.

2023-09-21 11:23:39 [6,564,651ms] [Warning] [omni.physx.tensors.plugin] Cannot assign transform to non-root articulation link at '/presenter/slider'
2023-09-21 11:23:39 [6,564,651ms] [Warning] [omni.physx.tensors.plugin] Cannot assign velocities to rigid body at '/presenter/slider'

Update: Seems like the velocity error is caused by having kinematicsEnabled set to False. Not sure how to enable it though – these didn’t work:

set_prim_property('/presenter/slider', 'kinematicsEnabled', True)
set_prim_property('/presenter/slider', 'physics:kinematicsEnabled', True)

Update: This turns on the kinematics:

from omni.isaac.core.utils.prims import get_prim_at_path, get_prim_property, set_prim_property
from pxr import UsdPhysics
prim = get_prim_at_path('/presenter/slider')
rigidAPI = UsdPhysics.RigidBodyAPI(prim)
attr = rigidAPI.GetKinematicEnabledAttr()
attr.Set(True)

Update: Turning on the kinematics now gives me an error that the body must be non-kinematic :(. So I have no idea what the story is here…

Update: The issue was the stiffness needed to be set to some high value like 100,000. Also the joint origins were not aligned. Now it works.

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