inav icon indicating copy to clipboard operation
inav copied to clipboard

Geofence option

Open digitalentity opened this issue 10 years ago • 25 comments

  • RTH if distance from home > threshold
  • RTH if stepping out of a user-defined polygon

digitalentity avatar Dec 20 '15 12:12 digitalentity

Also, in case of "fly away" add a condition: if geofence triggered RTH but UAV is still going away, trigger emergency landing

DzikuVx avatar Jan 04 '17 09:01 DzikuVx

or turn to home after XXXX meters.

AnandNL avatar Jul 07 '18 20:07 AnandNL

#3524

@AnandNL turn to home after XXXX meters is not geofence!

I have found some C# code for geofence. Still need a gui or export or import functions from google map as user interface.

public bool Contains(GeoLocation location) { if (!Bounds.Contains(location)) return false;

var lastPoint = _vertices[_vertices.Length - 1];
var isInside = false;
var x = location.Longitude;
foreach (var point in _vertices)
{
    var x1 = lastPoint.Longitude;
    var x2 = point.Longitude;
    var dx = x2 - x1;

    if (Math.Abs(dx) > 180.0)
    {
        // we have, most likely, just jumped the dateline (could do further validation to this effect if needed).  normalise the numbers.
        if (x > 0)
        {
            while (x1 < 0)
                x1 += 360;
            while (x2 < 0)
                x2 += 360;
        }
        else
        {
            while (x1 > 0)
                x1 -= 360;
            while (x2 > 0)
                x2 -= 360;
        }
        dx = x2 - x1;
    }

    if ((x1 <= x && x2 > x) || (x1 >= x && x2 < x))
    {
        var grad = (point.Latitude - lastPoint.Latitude) / dx;
        var intersectAtLat = lastPoint.Latitude + ((x - x1) * grad);

        if (intersectAtLat > location.Latitude)
            isInside = !isInside;
    }
    lastPoint = point;
}

return isInside;

}

http://alienryderflex.com/polygon/

JWC1304 avatar Jul 08 '18 10:07 JWC1304

@AnandNL turn to home after XXXX meters is not geofence!

By definition geofencing is using GPS to create a virtual geographic boundary. In that scope defining a barrier as a max distance from home seems legit to me and if properly implemented quite extendable as well.

digitalentity avatar Jul 08 '18 17:07 digitalentity

Hi! Could be freakin' nice to get a "lite" geofence mode, like a alternative mode of althold, where you can set a max altitude, and a max home distance, cause since the french law about professional drone change in last July, it's the only point where Inav can't be legal to use... And I'd love to be able to use my Inav setup instead of a DJI!

hugsgui avatar Nov 16 '18 14:11 hugsgui

A "hard" geofence distance (and height) would be nice to keep legal. As long as it's turned off by default. I live in a very flat area, so I would probably turn on the height fence to say 450 feet. We already know distance to home, so it's just a matter of how to deal when exceeding the max altitude or distance.

teckel12 avatar Nov 17 '18 02:11 teckel12

I saw in the Pawel spychalski's YouTube channel that he is working on a kind of bracking, for the next firmware, could be the option that the distance max would be triggering, cause for the max height, althold is already able to maintain the quad at a specific altitude.

hugsgui avatar Nov 17 '18 07:11 hugsgui

Maybe "hard" and "soft" geofence options? "hard" would trigger RTH, while "soft" would trigger position hold and throttle max speed until you're back inside the geofence? Maybe even a combination, for example, "soft" geofence at 0.8km and "hard" at 1.0km. Obviously, there would be OSD to notify of both. This would be like a warning before a RTH or possibly "land" was triggered.

teckel12 avatar Nov 17 '18 16:11 teckel12

I'd really like something like that, so I could work with my own Inav setup, would be amazing...

hugsgui avatar Nov 17 '18 17:11 hugsgui

Hi! Now this request seem to be open about 3 years ago, any news about a geofence option in INAV? Does any of the Devs could answer about it? Would be nice to know if we are waiting for something or if I should build an ardupilot setup even if I rather use INAV.

hugsgui avatar Feb 01 '19 13:02 hugsgui

This quad claims Geofencing using the YupiF7 FC: https://www.studiosport.fr/racer-corsair-s1-s3-studiosport-a17684.html also see Fincky video here: https://www.youtube.com/watch?v=8OJxaEc2Sbg

YupiF7: https://www.yupifc.com/

Anyone know if it's using an iNav fork and if so, where to find the source?

ianrmurphy avatar Aug 18 '19 07:08 ianrmurphy

betaflight fork not inav one

mStrangers avatar Aug 27 '19 16:08 mStrangers

OK understood - can't seem to find it though... Is the source published?

ianrmurphy avatar Aug 27 '19 17:08 ianrmurphy

as i know ,not published and it is not planed .

mStrangers avatar Aug 28 '19 17:08 mStrangers

Is that OK ref. GPL? If there was published source I would try and port to iNav...

ianrmurphy avatar Aug 29 '19 10:08 ianrmurphy

Is that OK ref. GPL? If there was published source I would try and port to iNav...

No, it's not ok. It's a violation of GPL.

etracer65 avatar Sep 18 '19 20:09 etracer65

in fact i don't think this violating the GPL , But i'm not a GPL specialist and this isn't my code.

mStrangers avatar Sep 20 '19 17:09 mStrangers

in fact i don't think this violating the GPL , But i'm not a GPL specialist and this isn't my code.

A derivative work based on a GPL licensed project (in this case Betaflight) that's being distributed without publishing the source code... That's the very definition of a GPL license violation.

etracer65 avatar Sep 20 '19 19:09 etracer65

Possibly what's happening here is that YupiFC distribute their binary (in the flight controller) and then offer the source only to those who a) have the binary and b) request it. I'm no GPL specialist either, but that may actually satisfy the GPL because I don't think the GPL requires broad publication of the 'derivative work' source just access to it to those entitled (i.e. those who have the binary).

ianrmurphy avatar Sep 20 '19 20:09 ianrmurphy

Nope, doesn't work that way. You can't withhold the source or otherwise charge for it (by only providing it to customers) and it must be freely available to anyone who wants it. Applying additional license terms to the GPL licensed software (such as requiring purchase or other terms of use) is expressly prohibited. By not providing the source of the derivative work they are not authorized to use the original licensed source. Period. The entire point of the GPL license is that it requires the propagation of the open source aspect. In a nutshell, by taking advantage of others' work for your benefit you're agreeing to contribute your improvements to further the project. You probably should read the GPL license terms for a better understanding.

https://www.gnu.org/licenses/gpl-3.0.en.html

etracer65 avatar Sep 20 '19 20:09 etracer65