Flightplan and improved GPS


#1

hi guys :slight_smile:

I tried to build my own “flightplan”, just to move my drone some meters away (current position + angle + ~20m distance). But GPS is very imprecise. Not only imprecise, it’s jumping from one point to another and i can’t control my drone through gps.

how did parrot develop the flightplan in freeflight app?

hope anybody can help me :wink:

UPDATE:
I walked a rectangle (about 4km/h) and record all position updates but I get only this waypoints…


#2

GPS only has an accuracy of 2.5metres
They probably use a tracking method to stabilise the GPS position before take off

You can use something like Kalman filter+pid over a couple of seconds to get a better GPS fix.

Other methods include assisted GPS
Differential GPS, rtk-GPS


#3

I don’t think Parrot uses the GPS in the manner you guys think, at least as it applies to coordinated movement.


#4

Hi,

Were you flying when you did this record?
When flying, gps coordinates are merged with other sensors to get a more accurate position.

By the way, you can do your own implementation of FlightPlan with the sdk \o/
Here is a thread that might help: Bebop Mavlink file format description?

Regards,
Djavan


#5

Hi,
thanks for your answers.

No, I just walked with the drone in my hand. GPS is getting much better when I was flying and stil better when i was flying and moving.
Is it possible with the implementation of FlightPlan to change the flightpath during one flight? I need to start manually, looking for my arrow, follow the arrow in a calculated direction and later i get a new direction.


#6

You can’t do that with FlightPlan (MAVLINK is a batched based protocol)… you generate your mavlink file, upload it to the drone, and then tell the drone to execute it. To make any changes to that plan requires you to upload a new copy, stop the current operation, and initiate a new one.

You can certainly do dynamic directed flight paths without relying on mavlink. However this means you are utilizing the control link between your device and the drone and instructing the drone on the fly what direction to go and at what speed/velocity based on the PCMD feature.

I’m pretty sure I wrote up some pseudo code to perform this function here in another thread. I can tell you with complete confidence that it is possible (and pretty damn accurate) as it is incorporated and fully operational in my own software.

Shell


#7

Here’s my comments on adjusting bearing…

And I’ll share some simple code for how to do this type of translation with latitude and longitude here:

Bearing:

    public double getBearingTo(Position position) {

        final double dLon = Math.toRadians(position.getLongitude() - longitude);

        final double y = Math.sin(dLon) * Math.cos(Math.toRadians(position.getLatitude()));
        final double x = Math.cos(Math.toRadians(latitude)) *
                Math.sin(Math.toRadians(position.getLatitude())) - Math.sin(Math.toRadians(latitude)) *
                Math.cos(Math.toRadians(position.getLatitude())) * Math.cos(dLon);

        final double bearing = Math.atan2(y, x);

        return (Math.toDegrees(bearing) + 360) % 360;
    }

Distance:

    public double getDistanceTo(final Position position, final boolean withLoiter) {

        if (position == null) return Double.MAX_VALUE;

        // pythagorean theorem
        final double dist = Math.sqrt(
                Math.pow(Math.toRadians(position.getLatitude()) - Math.toRadians(latitude), 2) +
                        Math.pow(Math.toRadians(position.getLongitude()) - Math.toRadians(longitude), 2)
        );

        // return distance in meters
        final double distance = EARTH_RADIUS_METERS * dist - (withLoiter ? loiteringDistance : 0);

        return distance > 0 ? distance : 0;
    }

Angle of attack:

    public int getAngleTo(Position position) {

        if (position == null) return Integer.MAX_VALUE;

        final double opposite = altitude;
        final double adjacent = getDistanceTo(position, false);

        return (int) Math.toDegrees(Math.atan2(opposite > 0 ? opposite : 0, adjacent > 0 ? adjacent : 0));
    }

#8

Thanks :wink:

I finished my GPS Navigation. On my Map which is showing all positon Updates it looks very nice and smooth (see attachment), but the track was completely wrong.

the real flight was about 5 to 15 Meter near my track.

I tried to reproduce this with an planned flight in freeflight and my drone is also flying about 5 to 15 meter next to track at flightplan.
Is this normal? Whats your typical accuracy?

best regards
sebastian


#9

My typical accuracy is pretty spot on… well within 5 meters.

Planned track:

Actual track:

Granted, this is with mavlink, but I have very similar results when I control the drone track real-time using control device based navigation.


#10

ok but the track is from drone gps?
i fixed a second gps tracker (above the battery) which is pretty accurate. then i compared both tracks and the track of the drone is about 15 meter wrong. not totally wrong, only shifted in a direction.

and watching the drone also shows that the track from the drone is not real.

without additional gps (maybe interference) the track is also not correct.

I’ll try out this one some more places tomorrow. weather and daytime shouldn’t have any effects.


#11

I apologize up front if this is interpreted as advertisement. Please don’t hesitate to delete this post if that is how this is taken.

You can see from the linked video that my drone’s physical location is pretty spot on with the recorded course.

Of course, this is with a B2. Mileage does vary with the B1 in my experience… but not 15 meters.

https://youtu.be/398EyNddbwE