From 106044be3863ee1ebe4f89fbbda6e59c44a58d46 Mon Sep 17 00:00:00 2001 From: Jaeyoung-Lim Date: Thu, 24 Mar 2022 07:59:53 +0100 Subject: [PATCH] Initialize global local projection for rovers This commit initializes the global and local projection for rovers --- .../rover_pos_control/RoverPositionControl.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/rover_pos_control/RoverPositionControl.cpp b/src/modules/rover_pos_control/RoverPositionControl.cpp index 1515a8a631..304364b8a9 100644 --- a/src/modules/rover_pos_control/RoverPositionControl.cpp +++ b/src/modules/rover_pos_control/RoverPositionControl.cpp @@ -421,17 +421,17 @@ RoverPositionControl::Run() position_setpoint_triplet_poll(); + if (!_global_local_proj_ref.isInitialized() + || (_global_local_proj_ref.getProjectionReferenceTimestamp() != _local_pos.ref_timestamp)) { + + _global_local_proj_ref.initReference(_local_pos.ref_lat, _local_pos.ref_lon, + _local_pos.ref_timestamp); + + _global_local_alt0 = _local_pos.ref_alt; + } + // Convert Local setpoints to global setpoints if (_control_mode.flag_control_offboard_enabled) { - if (!_global_local_proj_ref.isInitialized() - || (_global_local_proj_ref.getProjectionReferenceTimestamp() != _local_pos.ref_timestamp)) { - - _global_local_proj_ref.initReference(_local_pos.ref_lat, _local_pos.ref_lon, - _local_pos.ref_timestamp); - - _global_local_alt0 = _local_pos.ref_alt; - } - _trajectory_setpoint_sub.update(&_trajectory_setpoint); // local -> global