aboutsummaryrefslogtreecommitdiff
path: root/src/modules/attitude_estimator_so3
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-03-16 13:47:26 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-03-16 13:47:26 +0100
commit717e1bd374e7710ce579e91c45852bbba906eba8 (patch)
tree1dbd5bce449a300af5d0f06e5cd7146747751b79 /src/modules/attitude_estimator_so3
parenteccbccb8261a7d5ed27ec3e7447cce570fdb5d2e (diff)
downloadpx4-firmware-717e1bd374e7710ce579e91c45852bbba906eba8.tar.gz
px4-firmware-717e1bd374e7710ce579e91c45852bbba906eba8.tar.bz2
px4-firmware-717e1bd374e7710ce579e91c45852bbba906eba8.zip
Removed stupid sensor counter, replaced it with much more useful timestamps
Diffstat (limited to 'src/modules/attitude_estimator_so3')
-rwxr-xr-xsrc/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp b/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
index e79726613..7150218ff 100755
--- a/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
+++ b/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
@@ -445,7 +445,6 @@ int attitude_estimator_so3_thread_main(int argc, char *argv[])
// XXX write this out to perf regs
/* keep track of sensor updates */
- uint32_t sensor_last_count[3] = {0, 0, 0};
uint64_t sensor_last_timestamp[3] = {0, 0, 0};
struct attitude_estimator_so3_params so3_comp_params;
@@ -526,9 +525,8 @@ int attitude_estimator_so3_thread_main(int argc, char *argv[])
uint8_t update_vect[3] = {0, 0, 0};
/* Fill in gyro measurements */
- if (sensor_last_count[0] != raw.gyro_counter) {
+ if (sensor_last_timestamp[0] != raw.timestamp) {
update_vect[0] = 1;
- sensor_last_count[0] = raw.gyro_counter;
sensor_update_hz[0] = 1e6f / (raw.timestamp - sensor_last_timestamp[0]);
sensor_last_timestamp[0] = raw.timestamp;
}
@@ -538,9 +536,8 @@ int attitude_estimator_so3_thread_main(int argc, char *argv[])
gyro[2] = raw.gyro_rad_s[2] - gyro_offsets[2];
/* update accelerometer measurements */
- if (sensor_last_count[1] != raw.accelerometer_counter) {
+ if (sensor_last_timestamp[1] != raw.accelerometer_timestamp) {
update_vect[1] = 1;
- sensor_last_count[1] = raw.accelerometer_counter;
sensor_update_hz[1] = 1e6f / (raw.timestamp - sensor_last_timestamp[1]);
sensor_last_timestamp[1] = raw.timestamp;
}
@@ -550,9 +547,8 @@ int attitude_estimator_so3_thread_main(int argc, char *argv[])
acc[2] = raw.accelerometer_m_s2[2];
/* update magnetometer measurements */
- if (sensor_last_count[2] != raw.magnetometer_counter) {
+ if (sensor_last_timestamp[2] != raw.magnetometer_timestamp) {
update_vect[2] = 1;
- sensor_last_count[2] = raw.magnetometer_counter;
sensor_update_hz[2] = 1e6f / (raw.timestamp - sensor_last_timestamp[2]);
sensor_last_timestamp[2] = raw.timestamp;
}