Developer

Navigation algorithm for wind drift

I've been putting together my own UAV and live in SF so I'm always flying in high winds. Not over SF of course...I built a simulator in flash to hone my algorithm, but I wanted to put it out there to see if anyone had any suggestions. My idea is to basically calculate the optimal position, drift from the position and create a new virtual waypoint to target using a scaled version of the drift vector. It works well, but it does tend to hunt when turning into the wind. I could limit the offset of the virtual waypoint which should help a tad.Here's a link to the Flash Sim. (Requires Flash 10)Here's the Source with updated code to address wind better than the original.Click the image to run the Flash simulator:DriftComp.png
E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Developer
    Aerosonde latero-directional law
    What's that? And do you have a link? Thanks for the feedback!
    Jason
  • Developer
    function call should read:
    public function mapPoint(plane:Point ,oldWP:Point, newWP:Point) :Point
  • Developer
    I had the idea based on a time when I was with a pilot friend and we flew home from Cape Code to Boston. We hit a storm front coming perpendicular to us. He had me pick an imaginary point to the left of destination and rudder towards that point to counteract the wind. This was my only real flying experience, so this was simply based on that inspiration.

    The plane graphic's rotation is optimal and not based on the rotational momentum of the aircraft. I just pointed the graphic towards the new point. The red line is the accurate one.

    I don't have the values scaled right for a normal simulation, I need to work on that. Everything is measured in pixels right now... I'll fix tonight, but it won't be as fun to watch as it will be slow.

    The virtual waypoint is calculated by looking at the current location of the plane and the ideal. I map a point using a fitting equation I have - not sure the name - and create a vector from the plane to the ideal point. Then I add this vector to the waypoint, offsetting it. The larger I scale the vector before adding it to the waypoint, the better the effect seems to be, but in extreme cases it introduces some wild overshoots. I think I can do some type of dampening, maybe the D from a PID loop? I tried limiting the scaled offset but that failed and the plane never met the upwind waypoint.

    Here's the fitting code:

    public function mapPoint(p:Point ,oldWP:Point, newWP:Point) :Point
    {
    var r = ((plane.x - oldWP.x) * (newWP.x - oldWP.x) + (plane.y - oldWP.y) * (newWP.y - oldWP.y)) / WPdistance;
    r = Math.min(r,1)
    r = Math.max(r,0)
    var px = oldWP.x + r * (newWP.x - oldWP.x)
    var py = oldWP.y + r * (newWP.y - oldWP.y)
    return new Point(px,py);
    }
  • 3D Robotics
    Cool! One thing I didn't quite understand is how you determined where your "virtual waypoint" should be. Are you preprogramming the UAV with wind direction and strength? Just deriving it from the navigation error during crosstrack correction?
  • Eherm ... I would try to define a kind of maxvalue for the drift comp vector you are calculating ... Making it more agressiv but without making it unstable ... !?
  • The behavior is to be expected. The actual gain of your directional axis is increased when the vehicle goes upwind. You should have your stability margins high enough to accommodate that, there may be room to tweak it in your loop, or you may need an inner loop - with r, usually, I have seen the yaw rate measured on the body axis work - in the directional law. If wind ends up really being an issue, I would suggest switching to the Aerosonde latero-directional law, that always works.
This reply was deleted.