Skip to content

Commit

Permalink
Closes #342: Fix crash when pushing ext pos measurement and EKF disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Aug 23, 2018
1 parent f83f068 commit d1b37e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/src/crtp_localization_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ static void extPositionPackedHandler(CRTPPacket* pk)

bool getExtPosition(state_t *state)
{
// Only use position information if it's valid and recent
if ((xTaskGetTickCount() - crtpExtPosCache.timestamp) < M2T(5)) {
// Only use position information if it's valid, recent, and if the kalman filter is enabled
if (getStateEstimator() == kalmanEstimator &&
(xTaskGetTickCount() - crtpExtPosCache.timestamp) < M2T(5)) {
// Get the updated position from the mocap
ext_pos.x = crtpExtPosCache.targetVal[crtpExtPosCache.activeSide].x;
ext_pos.y = crtpExtPosCache.targetVal[crtpExtPosCache.activeSide].y;
Expand Down

0 comments on commit d1b37e0

Please sign in to comment.