mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
mc_att_control_main: make sure to initialize at least one gyro sensor
in HIL mode, gyros are published after mc_att_control started.
This commit is contained in:
@@ -835,7 +835,7 @@ MulticopterAttitudeControl::sensor_correction_poll()
|
||||
}
|
||||
|
||||
/* update the latest gyro selection */
|
||||
if (_sensor_correction.selected_gyro_instance < sizeof(_sensor_gyro_sub) / sizeof(_sensor_gyro_sub[0])) {
|
||||
if (_sensor_correction.selected_gyro_instance < _gyro_count) {
|
||||
_selected_gyro = _sensor_correction.selected_gyro_instance;
|
||||
}
|
||||
}
|
||||
@@ -1109,6 +1109,10 @@ MulticopterAttitudeControl::task_main()
|
||||
|
||||
_gyro_count = math::min(orb_group_count(ORB_ID(sensor_gyro)), MAX_GYRO_COUNT);
|
||||
|
||||
if (_gyro_count == 0) {
|
||||
_gyro_count = 1;
|
||||
}
|
||||
|
||||
for (unsigned s = 0; s < _gyro_count; s++) {
|
||||
_sensor_gyro_sub[s] = orb_subscribe_multi(ORB_ID(sensor_gyro), s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user