1102sc
(mulixiang)
June 15, 2018, 11:34am
1
#include <AP_HAL/AP_HAL.h>
#include "AP_L1_Control.h"
extern const AP_HAL::HAL& hal;
// table of user settable parameters
const AP_Param::GroupInfo AP_L1_Control::var_info[] = {
// @Param: PERIOD
// @DisplayName: L1 control period
// @Description: Period in seconds of L1 tracking loop. This parameter is the primary control for agressiveness of turns in auto mode. This needs to be larger for less responsive airframes. The default of 20 is quite conservative, but for most RC aircraft will lead to reasonable flight. For smaller more agile aircraft a value closer to 15 is appropriate, or even as low as 10 for some very agile aircraft. When tuning, change this value in small increments, as a value that is much too small (say 5 or 10 below the right value) can lead to very radical turns, and a risk of stalling.
// @Units: s
// @Range: 1 60
// @Increment: 1
// @User: Standard
AP_GROUPINFO("PERIOD", 0, AP_L1_Control, _L1_period, 20),
// @Param: DAMPING
// @DisplayName: L1 control damping ratio
// @Description: Damping ratio for L1 control. Increase this in increments of 0.05 if you are getting overshoot in path tracking. You should not need a value below 0.7 or above 0.85.
// @Range: 0.6 1.0
This file has been truncated. show original
I don’t understand the code:
/*
return the bank angle needed to achieve tracking from the last
update_*() operation
*/
int32_t AP_L1_Control::nav_roll_cd(void) const
{
float ret;
ret = cosf(_ahrs.pitch)*degrees(atanf(_latAccDem * 0.101972f) * 100.0f); // 0.101972 = 1/9.81
ret = constrain_float(ret, -9000, 9000);
return ret;
}
The “ret” is the bank angle of fixed wing,but the formula of get the bank angle, I don’t understand.
2 Likes