First off, let me start that I’m not questioning the code (it’s great!), I’d just like to follow the math a little better. I have stock LM legs (C or A) that I’ll be using, and not the Phoenix (P?) legs to work with. Hence I need to work out a few points.
As I’m starting to set up my 'quad legs (Octopod too?) and Phoenix code for “Little Cat”, I’ve run into some questions that I don’t recall encountering when building a hexapod from Powerpod-derived code. Or maybe I just forgot!
The first is the servo limits in Basic-coded degrees. I aligned my legs for 1500, and noted the limits in R/C servo pulses seen in Powerpod.
I fired up SSC-32 sequencer to work out the servo range limits. I also noticed that in addition to the pulse values there is a servo angle displayed in degrees. Yay! However the angle in degrees was automatically changed to ± 90 to end at my adjusted servo range! So getting a degree from that wasn’t very useful (maybe I’m using it the wrong way.
Servos aren’t typically calibrated or consistent either. So I can’t just copy the angles seen. Maybe if I leave the limits maxed out?
So I now have the pulse ranges that were useful in the PowerPod code, but Phoenix uses degrees! Anybody have a better way to come up with the limit angles in degrees?
In the PowerPod code the angle was scaled to servo pulses in an equation similar to this:
[code]/* scale the pulse to the range of the pulse / range of the angle /
/ Hp = ((2090 - 960) * (? - 21) / (107 - 21)) + 960 */
Hp = (unsigned long)(HipH_PULSE_MAX - HipH_PULSE_MIN) * (unsigned long)(HipH_Angle - HipH_ANGLE_MIN) /
(unsigned long)(HipH_ANGLE_MAX - HipH_ANGLE_MIN);
[/code]
Which I now have my doubts about. It looks like it would “compress” the angle to fit the servo range! I’ll have to do some more thinking about that later.
Back to the point, in Xan’s Phoenix code we see:
-RFCoxaAngle +90)/0.10588238)+650
With a “magic” number 0.10588238 which I take to be some scaling of pulses/ 90 degrees or something.
And 90/0.10588238 does in fact = 850 or very close.
650 + 850 = 1500, so I’m probably thinking on the right track, although I haven’t worked through all the “+90” and “* -1” stuff.
How did we come up with 650 (end of travel?) and 850? (if indeed that’s what it’s for) Good for a particular servo? I have a mix of '645 and '475 servos. I haven’t characterized them as yet. (the would all probably be a little different).
I could mount a compass (drawing instrument) on a servo shaft, and “characterize” my servos. Was that done to derive the 0.10588238 constant above? Or was the constant obtained from some other source?
What would be useful is a set of ‘C’ and ‘A’ leg constants, like is done in Powerpod.
Can we get some commentary on this topic?
Thanks!
Alan KM6VV