DexterInd / GoPiGo3

The GoPiGo3 is a Raspberry Pi Robot!
https://gopigo.io
Other
96 stars 85 forks source link

WIBNI: Easysensor Servo params in gpg_config.json #296

Open slowrunner opened 3 years ago

slowrunner commented 3 years ago

I know this is a real WIBNI

It would be so cool if class easysensors.Servo checked gpg_config.json for "servo-center" (in uS) and "servo-range" (in uS), and there existed a servo_calibration_gui program.

Then easysensor.Servo.reset_servo() could center the servo exactly, and
easysensor.Servo.rotate_servo(x) could be correct, (and the smaller "servo-range" could prevent servo stall if need be)

On my ModRob Servo Kit, the teeth on the servo and distance sensor servo mount are not sufficiently fine to center the servo then push the mount onto the servo in the centered direction. I have to use ps.rotate_servo(SERVO_1_CENTER_DEG) with value 85 degrees (1424uS), and my "servo-range" is only 1348.

(I do apologize for taking your time with a wild WIBNI.)

jharris1993 commented 2 years ago

I absolutely agree and believe this is a justified request instead of a pipe-dream "WIBNI" as it proposes a genuinely useful improvement to a widely supported feature of the robot.

My robot, Charlie, has a pan-and-tilt for his "head" (distance sensor/camera), and I have to keep a set of position constants in every file/program that makes use of the servos so that they can be centered properly.  This becomes a real problem if, for whatever reason, the base position of the servo(s) change.  (i.e.  I recently had to replace the horizontal positioning servo.)  It then becomes necessary to track down every occurrence of the servo calibration constants and change them.

I would be "jumping-up-and-down" happy if the positions, (and limits) were even in servo-degree units, (which is what I do), and use relative offsets from "center".

However, a more elegant solution would be the one @slowrunner recommended where the constants would be in signal units, (μSec), so that "90" becomes an accurate center point.  That being done, limit-of-travel could be done in the servo's degree units, (>= 17 and <= 170 for example)

Another option would be to modify the gpg_config.json to include the values, and mess with the calibration routines later.