px4-jsbsim-bridge icon indicating copy to clipboard operation
px4-jsbsim-bridge copied to clipboard

Added sensor_msg.id to avoid out of range error from PX4's SimulatorMavlink

Open toshiharutf opened this issue 6 months ago • 6 comments

Problem description

While running PX4_Autopilot (d98800521644ff2ba5d761c66a0d601016b96dac) in SITL with jsbsim, the following problem arise

image

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.

toshiharutf avatar Feb 26 '24 16:02 toshiharutf