Problem: _mag_device_id is used to get the correct rotation matrix for each
mag. But on POSIX, _mag_device_id was always 0, leading to invalid rotation
matrices.
This resulted in stale mag error messages (rot matrix=0 ==> mag data=0).
_mag_device_id was 0 because there are no /dev/magX devices (eg. on RPi),
thus the mag driver could not be opened.
This patch does: get the device id from the uorb topic instead. We still
need the device handle on certain platforms to apply the calibration params
and to check if the mag is internal or external.
Problem left: on POSIX, the check for external mag does not work.
Squashed commits:
[290660d] voted_sensors_update: revert the new_accel_data check (and others)
The check removed the ability to detect sensor timeouts.
[c8dc7ad] sensors: publish changes to sensor selection
[dd90dec] sensors: ensure all sensor selections published first time
This does the following if given:
- don't initialize the sensors (the sensor drivers are not started)
- publish sensor_combined even in hil mode
- do not apply or publish thermal corrections
Squashed commits:
[2df1d9e] sensors: change definition of sensor offset and scale factor to match legacy code
[089e103] sensors: publish thermal corrections for all sensors
This is to ensure that if sensor IDs are fixed we do not end up in a state where the system is partially calibrated and the need for re-calibration is not properly communicated to the user.
- reduces some code duplication
- provides clear API & separation for temp compensation
additional changes:
- added timestamp to sensor_correction topic
- reduced its publication rate, to only when voting index or scales or
offsets change (if there is more than 1deg change in temperature)
Enabled using TC_A_ENABLE and TC_G_ENABLE parameters
Disabled by default.
IMU offsets and scale factors for selected sensor published to sensor_correction topic
TODO Parameter storage method is cumbersome
The sensors app assumed that all topics are published on boot which is not necessarily true and it assumed that all publications had valid data. This change ensures that topics are initialized as they update the first time and that the consistency check only runs on topics which carry valid data.