GuidedMode Thrust control and AP_MOTORS_THST_HOVER_MIN/MAX clamping

Hello, I’ve been experimenting with guided mode and SET_ATTITUDE_TARGET. I’ve setup in AirSim and behaviour is more or less ok. I first read MOT_THR_HOVER value and then map my high level logical input of 0..1 (with 0.5 being middle) to throttle 0..1 (with MOT_THR_HOVER being the middle).

Something like this:

// hover = MOT_THR_HOVER = 0.28 
if(input < 0.5)
    throttle = lerp(0, hover, 2 * input);
    throttle = lerp(hover, 1, 2 * input - 1);

Which visually looks like this (maybe I should fit a smooth curve instead):

Fist I’d like to know if this is suggested scheme of control, or are there better ways? I know there is also climb rate control, but I am afraid it can be not very suitable for control by companion (maybe if play with dead zone variables), I think that throttle maybe more direct, not sure though, have to try both.

Second question is about AP_MOTORS_THST_HOVER_MIN (0.125) and AP_MOTORS_THST_HOVER_MAX (0.6875). I was unaware of these 2 and got some interesting experience of sending my quad to the outer space :slight_smile: because I was sure that MOT_THR_HOVER is what I need to read. But, apparently, my quad is a bit overpowered and real hover value is about 0.065 which I took by looking at the logs in AltHold mode (after beeing confused about drone behaviour).
So the question is - why do we need thins min/max clamp (I found that hover variable is clamped based on them in AP_MotorsMulticopter::update_throttle_hover? I know that PSC_ACCZ_I/P are calculated based on it and maybe they will be way off if real thrust is too small/high? Otherwise not sure why there is a clamp. Is it fine to just remove it?


Ok found this pull request I think it answers second question.
Still would like to know from somebody if controlling thrust as I showed is correct or maybe there is a better way.