I am working on creating a new flight mode that automatically sets up a new landing mission, based on where the vehicle was armed and what its heading was during arming/takeoff for runway information.
For that I need to know a way to access the log files (or another place where the heading during arming/takeoff is stored) during flight from within the AP software (a flight mode very similar to the auto mode).
Can anyone point me to which function I could use or how to achieve that? @tridge knows how to get that perhaps?
you can check on copter code how it is done.
On takeoff we store the home heading and then on landing we turn the drone to be the same heading. I won’t be surprised that something already exist into Plane codebase
Hey, thank you for your quick reply!
Yes, I came to the same conclusion - there is a AP::logger().get_log_data() and corresponding getter functions, but I agree that it might be a bit risky regarding corruption or not being supported with different boards/parameters.
Therefore I added a plane.initial_armed_bearing variable that is being initialized during the arm procedure.
I found that the Copter code is already using a similar approach for their RESETTOARMEDYAW functionality.
@khancyr you were a little faster typing than me I couldn’t find a home heading variable in plane yet, so I made my own, if there exists one I’d be happy to know so I can use that one instead!
In general I agree that the climb out course is the angle (or its 180deg counterpart) you want to use for landing, but especially during a hand launch we often had close encounters with trees as the launcher would give the plane a slight rotation by accident.
So for our use case we decided to include the plane to be aligned with the runway during arming in our pre-takeoff protocol. Though it would be a great addition if one could perhaps choose between these two options with parameter settings later on (eg. in a catapult launch there won’t be variation in heading)!