Open toshiharutf opened 9 months ago
Hi Jaeyoung, Thanks for the fast response. I have updated the bug description to better explain the fix. I haven't tested the setting you mentioned, but I think it is not related from what I saw in the code.
P.D. I wrote you an email to your instutional account. Please, check when you have the time.
The other possibility would be to address it from PX4, but since Gazebo seems to be working fine, I think this fix presents the least modifications.
@toshiharutf The problem is that the simulated sensors would be publishing to instance 0. Therefore, if you hardcode the instance number here, it would interfere with the simulated sensor instances.
@dagar FYI
@Jaeyoung-Lim , in the PX4 codebase, I only see mavlink_hil_sensor_t been used in SimulatorMavlink. If by interference, you mean problems between other sensors in the HIL_SENSOR msg, that is addressed with fields_updated.
TBH, I don't understand why SimulatorMavlink is sensors.id as a max length field. What would be your suggestion? should I attemp a fix for PX4?
Best regards,
publishing
I'm not quite sure why that is a problem? The JSBSim bridge code is publishing a simulated sensor's data.
I have been using the suggested change in my simulations for the past couple of weeks and have not noticed an issue. granted maybe I haven't run into a scenario where it is an issue. However, I would like to point out that the jsb simulator that is being provided with the current px4 software does not work.
Hi Eric, Yes, the bridge is indeed publishing data. The issue in this case is that some fields in the data stream create issues in the PX4 side.
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.