With the help of Machinekoder, I was able to write a simple component to run the rc servo like an axis via PWM.
I started out with the normal 50Hz update rate, but as the planner is sending all the values in between during the move, that was pretty choppy. I upped the PWM rate to 400Hz and it's much better and that still seems to work for both the analog and digital servo.
However at the higher update rate, the scale for the digital servo is much less linear, but it turns out there is compensation for this built into Machinekit. You just give it a file containing the measured requested and actual positions, and it will interpolate all the values in between. The compensation file can contain up to 256 data points. Right now the file just contains the straight values from 180 to -180, but I think I'm going to use vision to create that file. Then the servo can calibrate itself. Perfect.
The mirror servo did not like being fed the values in between at all. The mass of the lights/mirror made it chatter pretty badly. So I'm going to plumb that up as just a switch, which will pick between sending the angle for 'deploy' and and the angle for 'retract' to the PWM for that. Working on it.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.