Closed EAGrahamJr closed 4 months ago
I don't believe this constructor assumes 180 degree range of movement as per the new constructor comment:
public ServoTrim(int midPulseWidthUs, int ninetyDegPulseWidthUs, int minPulseWidthUs, int maxPulseWidthUs) {
this.midPulseWidthUs = midPulseWidthUs;
this.ninetyDegPulseWidthUs = ninetyDegPulseWidthUs;
this.minPulseWidthUs = minPulseWidthUs;
this.maxPulseWidthUs = maxPulseWidthUs;
minAngle = RangeUtil.map(minPulseWidthUs, midPulseWidthUs - ninetyDegPulseWidthUs,
midPulseWidthUs + ninetyDegPulseWidthUs, 0, 180, false);
maxAngle = RangeUtil.map(maxPulseWidthUs, midPulseWidthUs - ninetyDegPulseWidthUs,
midPulseWidthUs + ninetyDegPulseWidthUs, 0, 180, false);
}
Well, I'm an idiot -- I was putting the same value for the 90 degree as the mid-point, so of course it was coming out odd.
At least my new constructor is a little easier to use? :blush:
It took a while to figure out why my gear ratios were not matching real-world mappings until I realized that the servos I'm using (MG90s) move more than 180 degrees with an appropriate pulse-width setting, but the
ServoTrim
class assumes that a servo cannot move more than 180 degrees.Thus,
ServoTrim
should have additional constructors to cover these additional parameters (and adjust all the things accordingly).