mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
ekf2: initialize origin from corrent position when possible
This commit is contained in:
committed by
Mathieu Bresciani
parent
af752536b9
commit
130fefb1e7
@@ -113,7 +113,8 @@ void AuxGlobalPosition::update(Ekf &ekf, const estimator::imuSample &imu_delayed
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Try to initialize using measurement
|
// 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();
|
ekf.enableControlStatusAuxGpos();
|
||||||
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
||||||
_state = State::active;
|
_state = State::active;
|
||||||
|
|||||||
@@ -280,8 +280,7 @@ bool Ekf::resetGlobalPosToExternalObservation(double lat_deg, double lon_deg, fl
|
|||||||
uint64_t timestamp_observation)
|
uint64_t timestamp_observation)
|
||||||
{
|
{
|
||||||
if (!_pos_ref.isInitialized()) {
|
if (!_pos_ref.isInitialized()) {
|
||||||
ECL_WARN("unable to reset global position, position reference not initialized");
|
return setLatLonOriginFromCurrentPos(lat_deg, lon_deg, accuracy);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f pos_corrected = _pos_ref.project(lat_deg, lon_deg);
|
Vector2f pos_corrected = _pos_ref.project(lat_deg, lon_deg);
|
||||||
|
|||||||
Reference in New Issue
Block a user