There are lots of great animatronic and robotics props and projects out there, and it’s easy to make r/c servos and other actuators move using the Arduino servo library. This means that the servos stops and start very suddenly, moving as fast as they can between positions. In this video I’m going to show you two lines of very simple code to make things smoother.
It’s from the YouTuber
James Bruton, and he says it will make your robots more organic! For example, when using the Arduino servo
library, which can control up to 12 servos using one timer (on the Arduino Due you can control up to 60, apparently)…
James
writes:
“There are lots of great animatronic and robotics props and projects out there, and it’s easy to make r/c servos and other actuators move using the Arduino servo library. This means that the servos stops and start very suddenly, moving as fast as they can between positions. In this video I’m going to show you two lines of very simple code to make things smoother.”
To demo it, he creates – via 3D-printing and an Arduino Uno – an animatronic device with two big, cute eyeballs, each on their own pivot (moving left and right only). The eyelids share the same pivot point and there are three servos in total….
Basically, he takes 5% of the new value read from a switch and 95% of the previous value read, slowly decelerating movement…
CAD and code for his servo motion smoothing demo can be found on
GitHub.
And you can see it in action in the video below. Very impressive it is, too.