logger: delay topic initialization until logging is actually starting
- this is a fix for logger missing things like UAVCAN sensors
Threading in logger needs a careful review.
One potential downside is the impact on initial subscriptions here. https://github.com/PX4/PX4-Autopilot/blob/b8fb5dfa517874e193db847854c021bc98381707/src/modules/logger/logger.cpp#L848-L853
On second thought, maybe it's not an issue because we'll still try to subscribe in Logger::initialize_topics().
https://github.com/PX4/PX4-Autopilot/blob/b8fb5dfa517874e193db847854c021bc98381707/src/modules/logger/logger.cpp#L552
For the small issue of slightly delayed logging when started at arming one idea I've discussed with @MaEtUgR is to introduce another incremental arming state right before full ARMING_STATE_ARMED.
- any module that requires a valid initialization at arming registers the dependency with commander
- examples include logger init (preflight data, etc), and output modules (motor spool up and valid feedback)
- when arming is requested all preflight checks must pass and commander state machine enters ARMING_STATE_ARMED_INIT (name needs some thought)
- registered modules have a short window to init and report their status before commander can transition to full ARMING_STATE_ARMED
This PR with https://github.com/PX4/PX4-Autopilot/pull/20196
Looks like this is logging the cannode optical topics. Currently, if a topic is marked optional and is on a cannode, it appears after the logger module has started and doesn't get logged.
https://review.px4.io/plot_app?log=087072c8-1e93-4f12-b43f-07e8e8423b7b https://review.px4.io/plot_app?log=41ee8566-d94b-46cb-b970-417dad57cf78 https://review.px4.io/plot_app?log=f8bbb964-a210-4f12-ae62-dee4672aca21
I will need to look at this in detail