[ODE] Simulating spring in ODE.
Shamyl Zakariya
zakariya at earthlink.net
Tue Jan 6 16:37:18 MST 2004
I wrote a general springy joint type class for my system; here's a
snippet of the relevant code:
void SliderJoint::step( void )
{
if ( _stiffness > 0 )
{
dReal da = -dJointGetSliderPosition( _piston );
dReal spring = _initialRange * 5.0;
dReal velocity = da * spring;
dJointSetSliderParam( _piston, dParamFMax, _stiffness );
dJointSetSliderParam( _piston, dParamVel, velocity );
}
}
It behaves a little like the canonical servo motor example, but instead
of going to a set position it instead tries to return to the zero
point.
All you have to do is connect your slider joint to two cylinder bodies
and it will pull them together if they're pulled apart and will push
them apart if they're pushed together.
shamyl zakariya
"Our response to being bored and rich is not to discard
possessions and live more simply, but to buy more stuff
to reduce the space in which we might contemplate
our shame."
On Dec 31, 2003, at 10:28 AM, Danesh Tarapore wrote:
> Hi,
>
> Could anyine tell me how I could simulate a spring joining two
> cylinders in ODE.
>
> Thanks and wishing you a happy new year,
>
> Danesh.
>
> Do you Yahoo!?
> Find out what made the Top Yahoo! Searches of
> 2003_______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list