Skip to content

Commit

Permalink
ekf2: initialize origin from corrent position when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch committed Aug 23, 2024
1 parent 8698b84 commit 73c3bad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ void AuxGlobalPosition::update(Ekf &ekf, const estimator::imuSample &imu_delayed

} else {
// Try to initialize using measurement
if (ekf.setEkfGlobalOrigin(sample.latitude, sample.longitude, sample.altitude_amsl, sample.eph, sample.epv)) {
if (ekf.setEkfGlobalOriginFromCurrentPos(sample.latitude, sample.longitude, sample.altitude_amsl, sample.eph,
sample.epv)) {
ekf.enableControlStatusAuxGpos();
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
_state = State::active;
Expand Down
3 changes: 1 addition & 2 deletions src/modules/ekf2/EKF/ekf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ bool Ekf::resetGlobalPosToExternalObservation(double lat_deg, double lon_deg, fl
uint64_t timestamp_observation)
{
if (!_pos_ref.isInitialized()) {
ECL_WARN("unable to reset global position, position reference not initialized");
return false;
return setLatLonOriginFromCurrentPos(lat_deg, lon_deg, accuracy);
}

Vector2f pos_corrected = _pos_ref.project(lat_deg, lon_deg);
Expand Down

0 comments on commit 73c3bad

Please sign in to comment.