-
Notifications
You must be signed in to change notification settings - Fork 19.9k
Description
Bug report
Issue details
It appears that there is a sign error on the recently introduced support for LOCAL_FRD MAV_FRAME in the AC_PrecLand module. From my perspective it seems that "_inertial_data_delayed->Tbn" describes the rotation quaternion from the Body Frame to the NED frame. To rotate BODY_FRD (the previous, well tested MAV_FRAME used in AC_PrecLand) we rotate the FRD unit vector by the _intertial_data_delayed->Tbn quaternion to get NED Frame.
When doing this for LOCAL_FRD (which is yaw only, gravity aligned so no roll/pitch) we extract the Euler rotations from the BODY->NED quaternion and rotate by the Yaw only. This is correct, except that we are using rotate_xy( - yaw) which I believe to be incorrect.
I have flight-tested and proved this issue by changing my precision landing sensor from BODY_FRD (working) to LOCAL_FRD. Changing to this MAV_FRAME within the LANDING_TARGET message causes divergent behaviour any time the Copter is not aligned with North. If I remove the negative sign from the line below, I get comparable behaviour with BODY_FRD which is expected, as these are both body-yaw aligned frames.
Line in question:
https://github.com/ArduPilot/ardupilot/blob/master/libraries/AC_PrecLand/AC_PrecLand.cpp#L674
The functionality for LOCAL_FRD support was added in this PR: #30446
I believe there also must be an issue in the Simulation environment somewhere as this issue was clearly not picked up during the pull request completion.
Version
V4.7.0-dev | any version past the above linked PR.
Platform
Observed on Copter, assumed present on all.
[ X ] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine
Airframe type
X4 Quad - Hexsoon 450 EDU.
Hardware type
Cube Orange Plus
Logs
N/A currently.