I’m trying to setup a servo mount for pitch only, but my results indicate I’m not understanding it correctly:
I had set MNT1_PITCH_MAX to 90 and MNT1_PITCH_MIN to -90 for testing purposes and all seems well: the neutral pwm (1500), as well as MNT1_NEUTRAL_Y set to 0, places the servo in the middle of servos rotation pattern. I had also changed the SERVOX_MAX to 2150 and MIN to 825 to get that 180 degree rotation. I may be wrong in doing so, but it seemed to make sense, as my servo’s spec sheet says the PWM range is 500 - 2500 for its 270 degree movement, so I played with those values until it visually behaved as expected.
In any case, I set MNT1_PITCH_MAX to 20, and the middle/neutral position is offset by about 45 degrees. When testing it by tilting the quad the limits are still a full 180.
However, if I change the SERVOX_MAX/MIN back to its defaults the middle/neutral is still offset (but less so) and obeys some sort of tilt limit, visually about 45 degrees.
Apologies for sounding so helpless, but if someone could please explain to me how a 270 servo is supposed to be configured, as well as the tilt limits, it’d be much appreciated.
It seems I have a solution. However, it doesn’t seem like the right way.
I treat the MNT1_XXX params as is, i.e. MNT1_PITCH_MAX = 45 means 45 degree tilt limit, etc., and play with SERVOX_MIN/MAX until it looks right: middle/neutral pos is in the middle of the servo rotation, and the tilt limits looks close enough. This is the same “method” I did in my initial test to get 90 and -90 looking correct.
I suppose this is all fine and well, however, understanding is more important than accomplishing. Can someone confirm if this is the correct strategy, as well as explain why? I’m new to servos, however from my understanding, a servo’s pwm min/max is what it is, and should be set accordingly to SERVOX_MIN/MAX, i.e. in my case it should 500 - 2500 according to the spec sheet. I would think that Ardupilot would then interpret that range accordingly to obey the MNT1_PITCH_MAX, etc.
Updating title to correlate with this as well.
No, the correct way is to set the min, max angles to the values that you require and know the servo can do (relative to the frame body) and after that play with the PWM_ min, trim and max values until you get the results you want (min angle matching min desired min angle, neutral angle matching desired neutral andge and max angle matching desired max angle).
Of course all PWM values must be kept inside the manufactures limits of the servo.
Thank you for the explanation. I appreciate it.
Might be nice to have that small explanation in the documentation, so others who aren’t familiar with servos don’t have to scratch their heads as long as I did.
It is in the documentation. I did add it when we did the code to map the gimbal servo functions.
I think we have different ideas of what that means. I just read over the doc and see nothing that would indicate to an unknowing person the concepts behind that.
Did you read this:
The first point I described are correctly depicted there. But yes I agree that Aligning Min and Max PWM values with the full throw of the gimbal chapter is bogus and somehow simplistic.