[ODE] Servo to reach a target position

Olivier Michel Olivier.Michel at cyberbotics.com
Wed Apr 9 07:21:02 2003


Hello,

I have a servo motor and I want it to reach a target position.

The servo is implemented as a hinge and it seems to me that in ODE 
hinges are controlable either by applying a torque on the body (tricky 
and dangerous according to the ODE manual), or by specifying a target 
velocity (dParamVel) and a maximum torque (dParamFMax).

Since I just want to achieve a target position, I was considering 
setting the following:

dParamFMax: to define the maximum acceleration.
dParamVel: to define the target speed.
dParamHiStop or dParamLoStop: to define the target position.

My control program should read the current position of the servo and 
compute the following:

// set dParamFMax to a constant value
if (target_position > current_position) {
  // set dParamVel to a constant positive value
  // set dParamHiStop to target_position
  // possibly set dParamLoStop to current_position
  // run until target_position is reached
}else {
  // set dParamVel to a constant negative value
  // set dParamLoStop to target_position
  // possibly set dPareamHiStop to current_position
  // run until target_position is reached
}

Does this sound to be the right way to do position control on servos ? 
Are these any issues I should be aware of ?

-Olivier