developb wrote in Fri Mar 06, 2020 10:01 am:@wkitty42 Tried cmake with debug option; did not work. ( -DCMAKE_BUILD_TYPE=Debug)
@hooray
I want to understand code flow. As simple as that.
I understand the framework should be using xml file based data to generate tuning variables etc needed for the autopilot code.
I want to start here.
I am trying to get hands on over autopilot code/framework in flight gear, simultaneously understand software design, intermediate values during code flow using pid controller, the guidance loop and autopilot loop how they are designed etc. Rather than code walkthrough, I feel like spending some time debugging.
Can you help me with the smartest way out...
The FlightGear autopilot system is a different beast, you basically need to understand some important concepts first, before it makes sense to use a debugger or breakpoints
http://wiki.flightgear.org/Property_treehttp://wiki.flightgear.org/PropertyList_XML_Filehttp://wiki.flightgear.org/Autopilothttp://wiki.flightgear.org/Autopilot_Co ... _Referencehttp://wiki.flightgear.org/Autopilot_Tuning_ResourcesOnly once you understand how these things hang together (XML files loaded into a property tree data structure, which is in turn traversed to procedurally create a number of C++ data structures, which are in turn also property driven, will it make sense to look at the lower level implementation details)
Personally, I would use logging at the XML level - or look at the internals using FlightGear's 2D drawing support:
http://wiki.flightgear.org/Oscilloscope_addonhttp://wiki.flightgear.org/Canvas_Snippetshttp://wiki.flightgear.org/FGPlotThe "oscilloscope" addon could be easily extended to specifically support common autopilot elements and then track/display those as you wish.
This is implemented in a Javascript-like language that runs inside FlightGear, called "Nasal" - see the wiki for details.
With all that being said, I would probably start using FlightGear's built-in logging support (--log-level), and then set up "debug" for the AP in question, while disabling everything else (minimal startup profile, as per the wiki)
You will find all relevant files here:
https://sourceforge.net/p/flightgear/fl ... Autopilot/The common baseclass is this one:
https://sourceforge.net/p/flightgear/fl ... ponent.cxx(Note "debug" support there, which you could activate and/or extend as needed)
This would also be the right place to track code flow/callgraphs
For input value handling, refer to:
https://sourceforge.net/p/flightgear/fl ... tvalue.cxxThe whole AP system is set up here:
https://sourceforge.net/p/flightgear/fl ... opilot.cxxFor the initialization of the system, refer to $FG_ROOT/Main/fg_init.cxx, you will see two instances being set up there - one for FDM-rate coupled systems, and one called "property-rules" for framerate-coupled systems:
https://sourceforge.net/p/flightgear/fl ... t.cxx#l911