mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 02:30:35 +08:00
ekf2 support SET_GPS_GLOBAL_ORIGIN and remove globallocalconverter usage
- vehicle_command cmd extended from uint16 to support PX4 internal commands that don't map to mavlink
This commit is contained in:
@@ -410,17 +410,24 @@ RoverPositionControl::Run()
|
||||
|
||||
position_setpoint_triplet_poll();
|
||||
|
||||
//Convert Local setpoints to global setpoints
|
||||
// Convert Local setpoints to global setpoints
|
||||
if (_control_mode.flag_control_offboard_enabled) {
|
||||
if (!globallocalconverter_initialized()) {
|
||||
globallocalconverter_init(_local_pos.ref_lat, _local_pos.ref_lon,
|
||||
_local_pos.ref_alt, _local_pos.ref_timestamp);
|
||||
if (!map_projection_initialized(&_global_local_proj_ref)
|
||||
|| (_global_local_proj_ref.timestamp != _local_pos.ref_timestamp)) {
|
||||
|
||||
} else {
|
||||
globallocalconverter_toglobal(_pos_sp_triplet.current.x, _pos_sp_triplet.current.y, _pos_sp_triplet.current.z,
|
||||
&_pos_sp_triplet.current.lat, &_pos_sp_triplet.current.lon, &_pos_sp_triplet.current.alt);
|
||||
map_projection_init_timestamped(&_global_local_proj_ref, _local_pos.ref_lat, _local_pos.ref_lon,
|
||||
_local_pos.ref_timestamp);
|
||||
|
||||
_global_local_alt0 = _local_pos.ref_alt;
|
||||
}
|
||||
|
||||
// local -> global
|
||||
map_projection_reproject(&_global_local_proj_ref,
|
||||
_pos_sp_triplet.current.x, _pos_sp_triplet.current.y,
|
||||
&_pos_sp_triplet.current.lat, &_pos_sp_triplet.current.lon);
|
||||
|
||||
_pos_sp_triplet.current.alt = _global_local_alt0 - _pos_sp_triplet.current.z;
|
||||
_pos_sp_triplet.current.valid = true;
|
||||
}
|
||||
|
||||
// update the reset counters in any case
|
||||
|
||||
Reference in New Issue
Block a user