Steering output, what's the physical meaning?

Dear Ardupilot community,
it’s my first post here. I’m new to Ardupilot and I’m trying to understand some Ardurover source code (I’m reading version 3.2.0-rc3). My question is about the following function in mode.cpp
void Mode::calc_steering_from_lateral_acceleration(bool reversed)
I see that that function calls get_steering_out_lat_accel, which does the following

// return a steering servo output from -1.0 to +1.0 given a desired lateral acceleration rate in m/s/s.

Then the steering servo output is multiplied by 4500:

g2.motors.set_steering(steering_out * 4500.0f);

So my question is: why is steering from -4500 to +4500? Is it maybe the wheel steering angle in centidegrees? If so, what if my vehicle has a maximum wheel steering angle that is different to 45°?

Hi Roberto,

the -4500 ~ +4500 range is a historical thing dating back many years. The range is a bit meaningless and we can certainly change it to -1 ~ +1 in the future. In case it’s of interest, it stems from a historical limitation in the Plane code (which was the first ArduPilot code) in which full left or right roll (or pitch) led to a 45 degree bank angle. Way back then, we were using AVR boards and the developers thought that using integers would be faster than floats so they used centi-degrees instead of degrees or radians.

Great that you’re looking at the code. We’re always looking for more developers to get involved. Here’s a section on the wiki that tries to explain some of ArduPilot, I suspect you’ve already seen it but just in case.

Thank you very much for your answer rmackay9!
Despite the range -4500 ~ +4500 (which is just a matter of unit choice, after all), do you think that the physical meaning of wheel steering angle can be attributed to the argument of the set_steering function?
Using Ackermanm steering model, the wheel steering angle is in practice angle ϕ in the following figure.


Is my understanding correct?
Here’s an excerpt from AP_MotorsUGV.h

// internal variables
float   _steering;  // requested steering as a value from -4500 to +4500

I think that the quoted comment can be made clearer. Thanks again!

Yes, I think the steering number (-4500 ~ +4500) can be converted into a steering angle. The number should be linearly converted into a PWM output to the servo and I think the servo will take that and linearly move it’s arm to an angle… and if the steering linkages all have linear response then that’ll turn into a steering angle.

1 Like