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
You need to be a member of diydrones to add comments!
Comments
How do you activate Loiter ..? Is it preprogrammed in the code (waypoint to loiter and radius) you up-load or is there any external actication through PWM input ?
SID
So you have something like this:
****your original controler output code ****
Kp_Gs = 1.0; //or what ever you want
heading_cmd = ......//vector field calc output
heading_weight = Kp_Gs *( Vgs/V_cmd);
if (heading_weight > 1.6)
{
haeding_weight = 1.6;
}
if (heading_weight < 0.4)
{
haeding_weight = 0.4;
}
heading_cmd = heading_cmd * heading_weight;
The reason I do this is because when the aircraft comes in and out of phase with the wind (slowing down ground speed wise) the controller proportional gain is too high and it will oscilate.