# Position control of a joint

**URL:** <https://forums.developer.nvidia.com/t/position-control-of-a-joint/267135>\
**Category:** Isaac Sim\
**Created:** [September 21, 2023, 9:49am UTC](https://forums.developer.nvidia.com/t/position-control-of-a-joint/267135 "2023-09-21T09:49:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan.sandberg](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dan.sandberg](https://forums.developer.nvidia.com/u/dan.sandberg)\
**Post date:** [September 21, 2023, 9:49am UTC](https://forums.developer.nvidia.com/t/position-control-of-a-joint/267135/1 "2023-09-21T09:49:32Z")

</div>

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

```auto
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!

---

<div class="post-metadata">

**Author:** ![dan.sandberg](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dan.sandberg](https://forums.developer.nvidia.com/u/dan.sandberg)\
**Post date:** [September 21, 2023, 11:27am UTC](https://forums.developer.nvidia.com/t/position-control-of-a-joint/267135/2 "2023-09-21T11:27:34Z")

</div>

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.

```auto
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:

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

```

Update: This turns on the kinematics:

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 5, 2023, 11:27am UTC](https://forums.developer.nvidia.com/t/position-control-of-a-joint/267135/3 "2023-10-05T11:27:43Z")

</div>

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