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

MavLinkMultirotorApi: correctly set the HIL_SENSOR fields_updated field #2549

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1333,14 +1333,21 @@ class MavLinkMultirotorApi : public MultirotorApiBase
hil_sensor.ygyro = gyro.y();
hil_sensor.zgyro = gyro.z();

hil_sensor.fields_updated = 0b111 | 0b111000; // Set accel and gyro bit fields respectively

hil_sensor.xmag = mag.x();
hil_sensor.ymag = mag.y();
hil_sensor.zmag = mag.z();

hil_sensor.fields_updated = hil_sensor.fields_updated | 0b111000000; // Set mag bit field

hil_sensor.abs_pressure = abs_pressure;
hil_sensor.pressure_alt = pressure_alt;

hil_sensor.fields_updated = hil_sensor.fields_updated | 0b1101000000000; // Set baro bit field

//TODO: enable temperature? diff_pressure
hil_sensor.fields_updated = was_reset_ ? (1 << 31) : 0;
hil_sensor.fields_updated = was_reset_ ? (1 << 31) : hil_sensor.fields_updated;

if (hil_node_ != nullptr) {
hil_node_->sendMessage(hil_sensor);
Expand Down