mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
Copter: ModeFollow: fix YAW_BEHAVE_FACE_LEAD_VEHICLE
This commit is contained in:
committed by
Randy Mackay
parent
b8f83fc3a5
commit
f6c0aa9cf9
@@ -99,9 +99,11 @@ void ModeFollow::run()
|
||||
Vector3p pos_ned_m; // vector to lead vehicle
|
||||
Vector3f vel_ned_ms; // velocity of lead vehicle
|
||||
Vector3f accel_ned_mss; // accel of lead vehicle
|
||||
if (g2.follow.get_target_pos_vel_accel_NED_m(pos_ned_m, vel_ned_ms, accel_ned_mss))
|
||||
if (pos_ned_m.xy().length_squared() > 1.0) {
|
||||
yaw_rad = (pos_ned_m.xy() - pos_control->get_pos_target_NED_m().xy()).tofloat().angle();
|
||||
if (g2.follow.get_target_pos_vel_accel_NED_m(pos_ned_m, vel_ned_ms, accel_ned_mss)) {
|
||||
const Vector2p vec_to_lead_ne_m = pos_ned_m.xy() - pos_control->get_pos_target_NED_m().xy();
|
||||
if (vec_to_lead_ne_m.length_squared() > 1.0) {
|
||||
yaw_rad = vec_to_lead_ne_m.angle();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user