mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 06:43:34 +08:00
follow_target: use actual velocity measurement
This commit is contained in:
committed by
Daniel Agar
parent
5d9b3504f7
commit
2d6bc9b6e0
@@ -156,7 +156,14 @@ void FollowTarget::on_active()
|
||||
&(_target_position_delta(0)), &(_target_position_delta(1)));
|
||||
|
||||
// update the average velocity of the target based on the position
|
||||
_est_target_vel = _target_position_delta / (dt_ms / 1000.0f);
|
||||
if (PX4_ISFINITE(_current_target_motion.vx) && PX4_ISFINITE(_current_target_motion.vy)) {
|
||||
// No need to estimate target velocity if we can take it from the target
|
||||
_est_target_vel(0) = _current_target_motion.vx;
|
||||
_est_target_vel(1) = _current_target_motion.vy;
|
||||
_est_target_vel(2) = 0.0f;
|
||||
} else {
|
||||
_est_target_vel = _target_position_delta / (dt_ms / 1000.0f);
|
||||
}
|
||||
|
||||
// if the target is moving add an offset and rotation
|
||||
if (_est_target_vel.length() > .5F) {
|
||||
|
||||
Reference in New Issue
Block a user