mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 10:47:35 +08:00
mc_pos_control: reproject local position setpoint on local reference updates
This commit is contained in:
@@ -473,8 +473,15 @@ void
|
||||
MulticopterPositionControl::update_ref()
|
||||
{
|
||||
if (_local_pos.ref_timestamp != _ref_timestamp) {
|
||||
if (_ref_timestamp != 0) {
|
||||
/* reproject local position setpoint to new reference */
|
||||
float dx, dy;
|
||||
map_projection_project(&_ref_pos, _local_pos.ref_lat, _local_pos.ref_lon, &dx, &dy);
|
||||
_pos_sp(0) -= dx;
|
||||
_pos_sp(1) -= dy;
|
||||
}
|
||||
|
||||
_ref_timestamp = _local_pos.ref_timestamp;
|
||||
// TODO mode position setpoint in assisted modes
|
||||
|
||||
map_projection_init(&_ref_pos, _local_pos.ref_lat, _local_pos.ref_lon);
|
||||
_ref_alt = _local_pos.ref_alt;
|
||||
|
||||
Reference in New Issue
Block a user