mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
MC pos control: realize when we are on the trajectory but passed the target waypoint
This commit is contained in:
committed by
Lorenz Meier
parent
710a8e8f56
commit
c2e0246650
@@ -1127,6 +1127,11 @@ void MulticopterPositionControl::control_auto(float dt)
|
||||
|
||||
if (near) {
|
||||
/* unit sphere crosses trajectory */
|
||||
/* if copter is in front of curr waypoint, go directly to curr waypoint */
|
||||
if ((pos_sp_s - curr_sp_s) * prev_curr_s > 0.0f) {
|
||||
pos_sp_s = curr_sp_s;
|
||||
pos_sp_s = pos_s + (pos_sp_s - pos_s).normalized();
|
||||
}
|
||||
|
||||
} else {
|
||||
/* copter is too far from trajectory */
|
||||
|
||||
Reference in New Issue
Block a user