Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

src/lib/drivers/magnetometer/PX4Magnetometer.cpp: Workaround for sens… #818

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

jlaitine
Copy link

…ors not initializing with all the magnetometers

There is some issue with "sensors" module; it only takes into account the magnetometers which have published data before the module start.

Workaround this issue by publishing some initial "0" data right at the time of constructing the magnetometer driver. If the probing of the sensor fails, the orb gets anyhow unadvertised, so there is no extra sensor data lying around in the case the magnetometer is not present.

This also forces the magnetometer numbering to follow the startup order; without advertising the data the orb numbering depends on magnetometer initialization sequence - a magnetometer started later in the init scripts may publish it's first data before some other mag, which was started earlier. This is especially problematic when using the same scripts on different HW platforms which run on different speeds.

…he orb when creating magnetometer driver instance"

This reverts commit 20ff30c.
…ors not initializing with all the magnetometers

There is some issue with "sensors" module; it only takes into account the magnetometers which have published data
before the module start.

Workaround this issue by publishing some initial "0" data right at the time of constructing the magnetometer driver.
If the probing of the sensor fails, the orb gets anyhow unadvertised, so there is no extra sensor data lying
around in the case the magnetometer is not present.

This also forces the magnetometer numbering to follow the startup order; without advertising the data
the orb numbering depends on magnetometer initialization sequence - a magnetometer started later in the
init scripts may publish it's first data before some other mag, which was started earlier. This is especially
problematic when using the same scripts on different HW platforms which run on different speeds.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
@jlaitine jlaitine force-pushed the workaround_for_sensors_not_initializing_with_all_mags branch from 56928ac to dd6c283 Compare November 19, 2024 09:52
@jlaitine jlaitine requested a review from joukkone November 19, 2024 09:53
@jlaitine jlaitine merged commit 55f17c6 into main Nov 19, 2024
27 checks passed
@jlaitine jlaitine deleted the workaround_for_sensors_not_initializing_with_all_mags branch November 19, 2024 10:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants