mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 02:51:37 +08:00
position_estimator_inav: projection reinitialization on home change fixed
This commit is contained in:
@@ -544,13 +544,11 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
|||||||
if (home.timestamp != home_timestamp) {
|
if (home.timestamp != home_timestamp) {
|
||||||
home_timestamp = home.timestamp;
|
home_timestamp = home.timestamp;
|
||||||
if (ref_inited) {
|
if (ref_inited) {
|
||||||
ref_inited = true;
|
|
||||||
|
|
||||||
/* reproject position estimate to new reference */
|
/* reproject position estimate to new reference */
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
map_projection_project(&ref, home.lat, home.lon, &dx, &dy);
|
map_projection_project(&ref, home.lat, home.lon, &dx, &dy);
|
||||||
x_est[0] -= dx;
|
x_est[0] -= dx;
|
||||||
y_est[0] -= dx;
|
y_est[0] -= dy;
|
||||||
z_est[0] += home.alt - local_pos.ref_alt;
|
z_est[0] += home.alt - local_pos.ref_alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user