Vehicle descending when throttle set to MOT_THST_HOVER

I am connected to the SITL and trying to control my vehicle in stabilize mode using the MANUAL_CONTROL (#69) message.

I have queried the MOT_THST_HOVER parameter and it has a value of 0.4088680. If I takeoff and switch to stabilized mode with the Z field of MANUAL_CONTROL set to 409 (roughly MOT_THST_HOVER x 1000), the simulated vehicle will rapidly lose altitude. Setting the Z field to roughly 500 will keep the vehicle hovering.

The MOT_THST_HOVER value seems to have converged at 0.4088680, so it doesn’t seem like the autopilot needs more flight time to learn the value.

Conceptually, I am trying to find value for the Z field in the MANUAL_CONTROL so that the vehicle doesn’t drastically change altitude when switching into stabilize mode, but it seems that commanding Z to MOT_THST_HOVER isn’t the right solution here. How should I find this hover thrust?

Thanks in advance!

I’m wondering if you need to input 50% throttle to hover, like you’ve found, but the output, MOT_THST_HOVER, is being scaled by MOT_THST_EXPO - so the input and the output is not a 1:1 relationship

@CryogenicVeggies,

It sounds like maybe you’re using the MANUAL_CONTROL message from an offboard computer…?

I’d recommend that instead of doing this, use Guided mode (or GUIDED_NOGPS) and then send in the SET_ATTITUDE_TARGET mavlink message with the roll, pitch and yaw angles you’d like. With 4.1 there is also a GUID_OPTIONS parameter that allows specifying if you want the thrust field to be interpreted as an actual thrust value (from 0 to 1) or as a climb rate.

Ok, so to find the Z value that maps to the MOT_THST_HOVER, I would need the inverse function of the thrust curve. Do you know what the equation for the thrust curve is?
I see this page on the thrust curve but no equation for it. https://ardupilot.org/copter/docs/motor-thrust-scaling.html

Also, I guess does a Z input of 500 in MANUAL_CONTROL typically map to the MOT_THST_HOVER for a multi-copter, or would that be highly dependent on the specific vehicle?

That is correct, sending MANUAL_CONTROL while in Stabilize mode from an off board computer.

I did prototype sending SET_ATTITUDE_TARGET in Guided and GUIDED_NOGPS modes. This solved the issue with vertical control, but resulted in a different feel from AltHold and PosHold modes, which I was trying to avoid. With more effort I suppose I could tune the algorithm which converts joystick inputs to an attitude in order to make the modes feel more similar, but I fear that having this control logic on an off board computer may be quite difficult due to there being too much latency in the control loop. It was nice that the Stabilize flight mode felt very similar.

I was a bit tentative to pursue this option because there was not a lot of documentation on the Guided No GPS mode. Is it being used an alternative to Stabilize mode the typical use case?

@CryogenicVeggies,

Thanks for the extra info.

So in the end, there is a pilot controlling the vehicle using a joystick? in that case, MANUAL_CONTROL is the correct message to use. I don’t think you should do any scaling of the pilot’s throttle input that is then sent to AP because AP already does that… put another way, you should find that if 500 (or 50%) throttle is sent via the MANUAL_CONTROL message, the vehicle’s throttle output will be around the hover throttle value and it shouldn’t drastically climb or fall too much.

Remember though that in stabilize mode the pilot directly controls the throttle so he/she has control of thrust which is the same as acceleration so the vehicle is very likely to climb or descend.

By the way, most of the AP code (flight modes, controllers, etc) don’t know if a real RC transmitter/receiver is being used or if a joystick is being used. It all gets routed through the RC_Channel library and made to look the same to the rest of AP.

Thank you for the explanation. I guess the root real problem I wanted to solve was to get a trim for the throttle joystick to prevent the vehicle from climbing/falling drastically when entering Stabilize mode while flying. If 500 is close enough for that trim, then I am happy!

1 Like