Developer

Ardupilot 2.5 preview part 1

Hey all,I thought I would start featuring what's new in 2.5. As you might know it's more than bug fixes. It's an entirely rewritten version that's intended to scale up and be customizable for all sorts of fun things including future projects like Mega. I just finished the loitering code so I thought I'd post that feature first.On a tip from Ryan Beall, I implemented a simple vector field algorithm that holds the orbit around a location by specifying the radius to hold.Here is the code:
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
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Hi,
    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
  • Developer
    Good work man. My guess is you will see the same problems I'm seeing once you put this thing against wind etc. It requires some damping (ie derivative gain but not a lot) and you can also help the controller by using a deweighting scheme based on groundspeed (this is very important!)

    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.


This reply was deleted.