[ODE] Yet another question about servo emulation

Shamyl Zakariya zakariya at earthlink.net
Sat May 24 13:21:01 2003


Hey, I'll be damned. The joint *does* work as a motor. And all my 
explosions are gone!

But... as there's always a cloud to the silver lining, the servos don't 
seem as strong as before, in fact, unless they're moving quickly, 
they're often not able to lift the structure... why should they be 
weaker? Is this just a matter of examining my forces and tweaking them 
until they work, or is something darker and more nefarious going on?

BTW, I checked out Juice -- it's amazing. I wish I could try it out but 
I'm on OSX :P


On Saturday, May 24, 2003, at 07:59  AM, Nate W wrote:

> On Sat, 24 May 2003, Shamyl Zakariya wrote:
>
>> In my project, I need to model servo behavior, such that I can say in
>> my code, more or less something like this:
>> 	someServo->setPosition( angle )
>>
>> I gather several people have need for similar functionality.
>
> Juice certainly has that sort of thing.  But, I use the motor built 
> into
> the hinge joint itself, rather than an AMotor.  This probably doesn't 
> make
> much difference at run time, but it makes for slightly simpler code.
>
> As for the odd behavior you're seeing, my guess is that it stems from 
> your
> use of dInifinty for FMax.  Try this:
>
> void ServoMotor::step( void )
> {
>  	dReal da = _desired - getCurrentPosition(); //magnitude and direction
>
> 	dReal velocity = da * _speed;
>
> 	if (_verbose)
> 	{
> 		printf("ServoMotor::step()\tda: %.2f, velocity: %.2f\n", da, 
> velocity);
> 		dumpState();
> 	}
> 		
> 	dJointSetAMotorParam( _motor, dParamFMax, _force );
> 	dJointSetAMotorParam( _motor, dParamVel, velocity );
> }
>
> I don't think there's anything to be gained from the code you're using 
> to
> treat holding center as a special case.  It might even be the cause of 
> the
> instability you're seeing.
>
>> I'd really appreciate it if somebody here can point out what's wrong
>> with my code. Perhaps there's a logical error in the feedback loop?
>> perhaps I'm not fully understanding the dynamics of the way motors
>> work, or how to use ERP or CFM adjustments.
>
> I generally start by setting ERP to 1.0, and CFM to 0.0001.  If I get a
> lot of explosions, CFM = CFM * 10.  If I get no explosions, CFM = CFM /
> 10.  A value of 0.1 will be very stable, but also quite squishy, like 
> the
> bodies are made of rubber.  A value of 0.0000001 will be very rigid, 
> but
> prone to oscillations or explosions.  In between those extremes it's
> usually easy to find a setting that's reasonably stiff and reasonably
> stable; I just tweak CFM using those rules and usually get something 
> good
> after just a few iterations.
>
>> Also, one more thing -- if anybody can give me some notion of how to
>> get the torque force a joint/motor is experiencing while holding
>> position I'd also appreciate it. I gather the function
>> dJointGetFeedback() is the way to go, but I haven't tried it yet. And
>> I'm sufficiently new to this API that I'm uncertain about how to go
>> about doing this correctly.
>
> I think you're probably right, but I haven't messed with it either. :-)
>
> -- 
>
> Nate Waddoups
> Redmond WA USA
> http://www.natew.com
>
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode
>
>
Shamyl Zakariya
   "this is, after all, one of those movies where people spend a great
   deal of time looking at things and pointing."
	From a review of _Fantastic Voyage_