aboutsummaryrefslogtreecommitdiff
path: root/src/modules/attitude_estimator_ekf
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-12-27 14:42:30 +0400
committerAnton Babushkin <anton.babushkin@me.com>2013-12-27 14:42:30 +0400
commitfc0ffbbd63036d094ad61a328e406c64742b481d (patch)
treec9407998005a7f5bbaa2f0c0e7d327163c86de74 /src/modules/attitude_estimator_ekf
parent6a04d13e733700e7e2e90c20399889a79eae293a (diff)
parent464df9c5e8cac88c24ee080337970df74edcd239 (diff)
downloadpx4-firmware-fc0ffbbd63036d094ad61a328e406c64742b481d.tar.gz
px4-firmware-fc0ffbbd63036d094ad61a328e406c64742b481d.tar.bz2
px4-firmware-fc0ffbbd63036d094ad61a328e406c64742b481d.zip
Merge branch 'ekf_acc_comp' into vector_control2
Diffstat (limited to 'src/modules/attitude_estimator_ekf')
-rwxr-xr-xsrc/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
index db0ef6228..36e82db43 100755
--- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
+++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
@@ -276,6 +276,9 @@ const unsigned int loop_interval_alarm = 6500; // loop interval in microseconds
float gyro_offsets[3] = { 0.0f, 0.0f, 0.0f };
unsigned offset_count = 0;
+ /* actual acceleration (by GPS velocity) in body frame */
+ float acc[3] = { 0.0f, 0.0f, 0.0f };
+
/* rotation matrix for magnetic declination */
math::Matrix<3, 3> R_decl;
R_decl.identity();
@@ -371,7 +374,6 @@ const unsigned int loop_interval_alarm = 6500; // loop interval in microseconds
sensor_last_timestamp[1] = raw.timestamp;
}
- float acc[3];
if (gps.fix_type >= 3 && gps.eph_m < 10.0f && gps.vel_ned_valid && hrt_absolute_time() < gps.timestamp_velocity + 500000) {
if (last_gps != 0 && gps.timestamp_velocity != last_gps) {
float gps_dt = (gps.timestamp_velocity - last_gps) / 1000000.0f;
@@ -388,20 +390,18 @@ const unsigned int loop_interval_alarm = 6500; // loop interval in microseconds
acc[i] += att.R[j][i] * acc_NED[j];
}
}
+
+ vel_prev[0] = gps.vel_n_m_s;
+ vel_prev[1] = gps.vel_e_m_s;
+ vel_prev[2] = gps.vel_d_m_s;
}
+ last_gps = gps.timestamp_velocity;
} else {
acc[0] = 0.0f;
acc[1] = 0.0f;
acc[2] = 0.0f;
- }
- if (gps.vel_ned_valid) {
- vel_prev[0] = gps.vel_n_m_s;
- vel_prev[1] = gps.vel_e_m_s;
- vel_prev[2] = gps.vel_d_m_s;
- last_gps = gps.timestamp_velocity;
- } else {
vel_prev[0] = 0.0f;
vel_prev[1] = 0.0f;
vel_prev[2] = 0.0f;
@@ -481,7 +481,7 @@ const unsigned int loop_interval_alarm = 6500; // loop interval in microseconds
continue;
}
- if (last_data > 0 && raw.timestamp - last_data > 12000)
+ if (last_data > 0 && raw.timestamp - last_data > 30000)
printf("[attitude estimator ekf] sensor data missed! (%llu)\n", raw.timestamp - last_data);
last_data = raw.timestamp;