# [ODE] holding a chain at a certain level for a marionette

nick knouf nknouf at zeitkunst.org
Sun Jun 17 12:20:02 MST 2007

```Hello list members,

I'm having a problem with something that should be fairly simple...

I have a rectangular geom (mostly xz) with four vertical (+y) chains
at each of the corners.  The chains are 20 units long.  Each chain is
connected to the rectangular geom by a ball joint.  The end goal is
the simulation of a very basic marionette-like creature.  I know the
desired position of the last element in the chain.  I can start out
the simulation just fine, with a regular applied force to the last
element of each of the four chains--the marionette floats in space.
However, if I apply additional work (above a holding force) to one of
the chains, that part of the creature rises, as expected (creating a
new holding position for that one chain only), but when I stop
applying work, the chain does not remain where expected: the x and z
components are within +- 0.01 of the desired position, but the y
component varies by over -4.0.

Pseudo-code for the holding algorithm is as follows:

currentVelocity = finalChainElement.getLinearVel()
currentPosition = finalChainElement.getPosition()
desiredPosition = holdPosition

desiredVelocity = desiredPosition - currentPosition
desiredAccel = desiredVeclocity - currentVelocity
finalChainElement.addForce(holdingMass * desiredAcel + holdingForce)

I've tried a variety of additions to this method, including lookahead
and PID controllers.  In every case the x and z components remain
within +-0.01 of the desired position, while the y component is often
-4.0 or larger.

I'm using ODE 0.8 with the PyODE bindings.

What could I do to make the y component of the chain be closer to its
desired position?

Thanks,

nick knouf
```