Skip to content

Commit

Permalink
refactor start of gps into separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilritz authored and bresch committed Aug 7, 2020
1 parent 7eb2b08 commit 310b989
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
11 changes: 1 addition & 10 deletions EKF/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,16 +514,7 @@ void Ekf::controlGpsFusion()

// If the heading is valid start using gps aiding
if (_control_status.flags.yaw_align) {
resetHorizontalPositionToGps();

// when adding with optical flow,
// velocity reset is not necessary
if (!_control_status.flags.opt_flow) {
resetVelocityToGps();
}

ECL_INFO_TIMESTAMPED("starting GPS fusion");
_control_status.flags.gps = true;
startGpsFusion();
}
}

Expand Down
3 changes: 1 addition & 2 deletions EKF/ekf.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,9 @@ class Ekf : public EstimatorInterface
return sensor_timestamp + acceptance_interval > _time_last_imu;
}

void startGpsFusion();
void stopGpsFusion();

void stopGpsPosFusion();

void stopGpsVelFusion();

void startGpsYawFusion();
Expand Down
14 changes: 14 additions & 0 deletions EKF/ekf_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,20 @@ void Ekf::loadMagCovData()
P.slice<2, 2>(16, 16) = _saved_mag_ef_covmat;
}

void Ekf::startGpsFusion()
{
resetHorizontalPositionToGps();

// when using optical flow,
// velocity reset is not necessary
if (!_control_status.flags.opt_flow) {
resetVelocityToGps();
}

ECL_INFO_TIMESTAMPED("starting GPS fusion");
_control_status.flags.gps = true;
}

void Ekf::stopGpsFusion()
{
stopGpsPosFusion();
Expand Down

0 comments on commit 310b989

Please sign in to comment.