Life-like movement

Is there a way to program a servo so the delay causes it to pick up speed or reduce speed as it moves to the position?
In 3d animation terms you would have to add curves to a body movement for it to look like natural human motion.
The delays below would control the servo arm speed but at a steady rate.
Is there any code that lets you pick a motion curve for each movement along with the speed?

 // Sweep from 0 to 180 degrees:
  for (angle = 0; angle <= 180; angle += 1) {
    myservo.write(angle);
    delay(15);
  }
  // And back from 180 to 0 degrees:
  for (angle = 180; angle >= 0; angle -= 1) {
    myservo.write(angle);
    delay(30);
  }

Any function that has the output 0 to 180 can be used, or a lookup table.

An input 0 to whatever, the function gives output of servo position.

Like

servoPosition = 180 * sin(pi/2 * t);

Would make a certain motion as t goes form 0 to 1.

a7

1 Like

You could have a look at that library

1 Like

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