This is an except from the APM Rover skid steer code:
channel_steer->servo_out = 4500*motor1;
channel_throttle->servo_out = 100*motor2;
Note the magic numbers 100 and 4500. Obviously, these are being used to convert the throttle for each motor to the range used by each channel output, but where is it defined? I looked all through the code with CTRL+F and was unable to find any references for either channel where their input range was obviously set.
Lets do the second one first as its an easy one. Its a percentage of throttle output calculation. The code calculates motor2 and for example gets 0.32 - it then converts that to 32% by multiplying it by 100 - the code needs to get back to whole percentage.
The second one is an angle - 45 degrees but its in centidegress so its 4500. Is the travel we assume a servo has - 45 degrees from centre.
Hope that helps. Thanks Tom C. for bringing this question to my attention
I understand the ranges, but what I’m wondering is what sets the range. In real life, those are just servo channels which range from ~1000-2000uS. What sets them to accept different ranges of input?
I’m not sure what you mean by “what sets the range”? Servo’s have a physical amount of travel. 45 degress in each direction is usually a safe bet for most servos.