A mistake in Arduplane 2.74b (AP_L1_Cntroller.cpp)

While trying to understand the code of L1 controller, I think I’ve found a mistake in AP_L1_Controller.cpp. In AP_L1_Control::update_waypoint() there are lines:

//Limit sine of Nu1 to provide a controlled track capture angle of 45 deg
sine_Nu1 = constrain_float(sine_Nu1, -0.7854f, 0.7854f);

Instead of limitting to +/-0.7071f = +/- sin(45 deg) it limits to +/-0.7854f = +/- pi/4

@minhtq98,
Thanks for the heads up. I have emailed our L1 programmer about what you have found.
Regard,
TCIII Admin

just letting you know that this has been fixed in git master.
Thanks for letting us know!
Cheers, Tridge

Is there any documentation on L1 navigation? I’d like to know why L1_dist is calculated as 1/pi * _L1_damping * _L1_period * groundSpeed. Does anyone have any idea?

In update_waypoint() most of the time the drone is in track capture or in tracking modes. In track capture mode it aims at a point on the track that beta = 45 degrees, in tracking mode it aims at a point on the track that is L1_dist away.
However, in track capture mode if the angle between the track and the line connected the drone and the next waypoint > 45 degrees and in tracking mode if the distance to next waypoint is less than L1_dist then I think it’s more reasonable to aim directly to next waypoint

@minhtq98,
Here is a link to some L1 documentation: plane.ardupilot.com/wiki/navigation-tuning/
Regards,
TCIII Admin

I’ve read the navigation tuning, but there is no word about the reason, only the formula of L1_dist. It’s a feeling that it is somehow misleading as L1_dist can be passed in much shorter time than L1_period.