Added sensor_msg.id to avoid out of range error from PX4's SimulatorMavlink #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem description
While running PX4_Autopilot (d98800521644ff2ba5d761c66a0d601016b96dac) in SITL with jsbsim, the following problem arise
This is originated here
src/modules/simulation/simulator_mavlink/SimulatorMavlink.cpp
if (sensors.id >= ACCEL_COUNT_MAX) { PX4_ERR("Number of simulated accelerometer %d out of range. Max: %d", sensors.id, ACCEL_COUNT_MAX); return; if (sensors.id >= MAG_COUNT_MAX) { PX4_ERR("Number of simulated magnetometer %d out of range. Max: %d", sensors.id, MAG_COUNT_MAX); return;
Note
Not sure why sensors.id is used as the max field length.
Solution
Added sensor_msg.id to acc, gyro and mag to avoid "Number of simulated…… xxx out of range" error from PX4's SimulatorMavlink class.