All Posts (14056)
Sort by
XTRACK_GAIN = .2if (abs(bearing_error) < 25) { bearing_error += sin(radians(crosstrack_heading - bearing_error)) * wp_distance * XTRACK_GAIN;}We set the crosstrack from our starting location as the angle toward the waypoint. As we get blown from side to side, that angle changes. We run that through sine to get a nice ratio and multiply it to get an angle to add to our heading.Depending on the gain and bearing error, we can get wild results, so we need to limit the effect to a range of degrees. In this case 25°. If we go outside of 25° by a lot, we can reset the crosstrack to be from the current location.Here is an example:
if(LOITER){ if (WP_distance < radius){ power = WP_distance / radius; }else if (WPDistance < (radius * 2)){ power = (radius - WP_distance) / radius; } bearing_error += power * -90;}This says the closer we are to the radius the more we turn 90 to the waypoint. The sign can be changed to adjust the direction of orbit for things like implementing turn prediction. Simple!In Ardupilot 2.5 you will be able to loiter over any location or specific waypoints.That's it.-Jason
Antenna Pan Tilt Test Flight from Mr.Pibb on Vimeo.