Browse Source

q_estimator: correctly handle loss of external yaw estimation

sbg
Arkadiusz Niemiec 6 years ago committed by Kabir Mohammed
parent
commit
075c836dfb
  1. 33
      src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp

33
src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp

@ -361,15 +361,20 @@ void AttitudeEstimatorQ::task_main() @@ -361,15 +361,20 @@ void AttitudeEstimatorQ::task_main()
// Hence Rvis must be transposed having (Rwr)' * Vw
// Rrw * Vw = vn. This way we have consistency
_vision_hdg = Rvis.transpose() * v;
// vision external heading usage (ATT_EXT_HDG_M 1)
if (_ext_hdg_mode == 1) {
// Check for timeouts on data
_ext_hdg_good = vision.timestamp > 0 && (hrt_elapsed_time(&vision.timestamp) < 500000);
}
}
}
}
// vision external heading usage (ATT_EXT_HDG_M 1)
if (_ext_hdg_mode == 1) {
// Check for timeouts on data
uint64_t time_topic;
if (orb_stat(_vision_odom_sub, &time_topic)) {
/* error getting last topic publication time */
time_topic = 0;
}
_ext_hdg_good = time_topic > 0 && (hrt_elapsed_time(&time_topic) < 500000);
}
bool mocap_updated = false;
orb_check(_mocap_odom_sub, &mocap_updated);
@ -393,15 +398,19 @@ void AttitudeEstimatorQ::task_main() @@ -393,15 +398,19 @@ void AttitudeEstimatorQ::task_main()
// Hence Rmoc must be transposed having (Rwr)' * Vw
// Rrw * Vw = vn. This way we have consistency
_mocap_hdg = Rmoc.transpose() * v;
// Motion Capture external heading usage (ATT_EXT_HDG_M 2)
if (_ext_hdg_mode == 2) {
// Check for timeouts on data
_ext_hdg_good = mocap.timestamp > 0 && (hrt_elapsed_time(&mocap.timestamp) < 500000);
}
}
}
}
// Motion Capture external heading usage (ATT_EXT_HDG_M 2)
if (_ext_hdg_mode == 2) {
// Check for timeouts on data
uint64_t time_topic;
if (orb_stat(_mocap_odom_sub, &time_topic)) {
/* error getting last topic publication time */
time_topic = 0;
}
_ext_hdg_good = time_topic > 0 && (hrt_elapsed_time(&time_topic) < 500000);
}
bool gpos_updated = false;
orb_check(_global_pos_sub, &gpos_updated);

Loading…
Cancel
Save