fix posctl heading hold

This commit is contained in:
Mark Whitehorn 2015-06-04 08:28:43 -06:00 committed by Lorenz Meier
parent e5e4db1923
commit 1f3c5d00e4
1 changed files with 2 additions and 2 deletions

View File

@ -912,8 +912,8 @@ void FixedwingPositionControl::get_waypoint_heading_distance(float heading, floa
if (flag_init) { if (flag_init) {
// on init set first waypoint to momentary position // on init set first waypoint to momentary position
waypoint_prev.lat = _global_pos.lat; waypoint_prev.lat = _global_pos.lat - cos(heading) * (double)(HDG_HOLD_SET_BACK_DIST) / 1e6;
waypoint_prev.lon = _global_pos.lon; waypoint_prev.lon = _global_pos.lon - sin(heading) * (double)(HDG_HOLD_SET_BACK_DIST) / 1e6;
} else { } else {
/* /*
for previous waypoint use the one still in front of us but shift it such that it is for previous waypoint use the one still in front of us but shift it such that it is