ekf2 fix and enforce code style

This commit is contained in:
Daniel Agar
2016-08-05 22:26:02 -04:00
committed by Lorenz Meier
parent 968a3d499b
commit 8f01324890
2 changed files with 7 additions and 3 deletions
-1
View File
@@ -16,7 +16,6 @@ find src/ \
-path src/lib/matrix -prune -o \
-path src/modules/attitude_estimator_ekf -prune -o \
-path src/modules/commander -prune -o \
-path src/modules/ekf2 -prune -o \
-path src/modules/ekf_att_pos_estimator -prune -o \
-path src/modules/mavlink -prune -o \
-path src/modules/mc_att_control -prune -o \
+7 -2
View File
@@ -486,7 +486,9 @@ void Ekf2::task_main()
if (range_finder_updated) {
orb_copy(ORB_ID(distance_sensor), _range_finder_sub, &range_finder);
if (range_finder.min_distance >= range_finder.current_distance || range_finder.max_distance <= range_finder.current_distance) {
if (range_finder.min_distance >= range_finder.current_distance
|| range_finder.max_distance <= range_finder.current_distance) {
range_finder_updated = false;
}
}
@@ -522,6 +524,7 @@ void Ekf2::task_main()
// read mag data
if (sensors.magnetometer_timestamp_relative == sensor_combined_s::RELATIVE_TIMESTAMP_INVALID) {
_ekf.setMagData(0, sensors.magnetometer_ga);
} else {
_ekf.setMagData(sensors.timestamp + sensors.magnetometer_timestamp_relative, sensors.magnetometer_ga);
}
@@ -529,6 +532,7 @@ void Ekf2::task_main()
// read baro data
if (sensors.baro_timestamp_relative == sensor_combined_s::RELATIVE_TIMESTAMP_INVALID) {
_ekf.setBaroData(0, &sensors.baro_alt_meter);
} else {
_ekf.setBaroData(sensors.timestamp + sensors.baro_timestamp_relative, &sensors.baro_alt_meter);
}
@@ -822,7 +826,8 @@ void Ekf2::task_main()
if (lpos.dist_bottom_valid) {
global_pos.terrain_alt = lpos.ref_alt - terrain_vpos; // Terrain altitude in m, WGS84
global_pos.terrain_alt_valid = true; // Terrain altitude estimate is valid
} else {
} else {
global_pos.terrain_alt = 0.0f; // Terrain altitude in m, WGS84
global_pos.terrain_alt_valid = false; // Terrain altitude estimate is valid
}