Since orb_exist doesn't work on the Snapdragon Linux side, we need to do
an additional orb_check after the orb_subscribe_multi, otherwise we copy
garbage.
The segfault was triggered by a count/length information about ESC
packets which lead to access outside the struct in the garbage case.
Since the vehicle_status topic has been split up, we can't publish it
together with the the split cpuload and commander_state topics.
Therefore, the log field STAT.MainState will change to COMM.MainState
because it is only the internal commander state. Important to the
outside is STAT.NavState.
Likewise, the log field STAT.Load becomes LOAD.CPU.
In SITL and on Snapdragon, the logging performance is high enough, so we
can log both: the usual topics, as well as the ekf2 replay fields.
Note that the ekf2 replay still needs to be enabled via param.
* sdlog2: move from STAT.MainState to COMM.MainState
This fixes a bug where vehicle_system_status and the commander internal
state were conflicting.
This will need adaptations in logging tools.
* sdlog2: don't bother changing STAT.MainState
For compatibility reasons, let's stick to the used log field (but still
fix the bug where the buffer (union) was overwrittern.
- either sensor combined or the replay topic where copied into
the union buffer but at times the memory was overwritten by other
topics which updated below
- this change makes sure that the two topics are copied into the union
buffer at the correct location in the code
This fixes an issue where topics where not subscribed to on the Linux
side on Snapdragon. It's a hack until there is a proper fix for the
orb_exists() call.
Most condition bools in the commander are not used anywhere but in the
commander. It therefore makes sense to move them to a different internal
struct and remove them from the vehicle_status message.
Also, the land_detected should be used by all the modules instead of
getting it through the commander and system_status.
The commander used to consume the battery_status topic and write the
contents after some calculations into the system state. Instead, the
calculations now happen in library calls in systemlib/battery.
This moves the battery fields out of the vehicle_status message into the
battery_status topic.
This brought quite some changes in all modules that need battery
information. The current state is compiling but untested.
Only free the logbuffer if you exit sdlog2. After disarming, just reset
the pointers. This way, we don't take any risks doing malloc and free.
The actual "double free" was caused by trying to free the perf counter
inside logbuffer_free.