ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.08k stars 17.64k forks source link

Bug: There maybe a bug in void AP_AHRS::calc_trig function. #26488

Open luweiagi opened 8 months ago

luweiagi commented 8 months ago

Hi, @tridge @priseborough

https://github.com/ArduPilot/ardupilot/blob/9a092e4e3a7ef4148d40827268a8929906f5bf03/libraries/AP_AHRS/AP_AHRS_Backend.cpp#L126

image

should be fixed as: (because cx2 may be bigger than 1)

image

peterbarker commented 4 days ago

I think this is probably a good change.

Have you seen this happen in practice? There is code in DCM which prevents the transformation matrix getting out of shape, and I think most other places tend to create the transformation matrix from a quaternion....

Any reason you didn't create a PR for this one?