Pardon if there's a more precise/technical way of formulating this question :)
What I'm currently working on is a proximity warning with Arduino. There's a preset GPS location in the sketch and if I'm moving closer to it, once I cross a set distace threshold, action is triggered.
I think picture will do better explaining on what challenge I wish to overcome here. Calculating simple "straight line" distance between my current geolocation and the preset destination is easy, but as you can see in the illustration I made, it works from all directions.
100 meter from the target is valid here from any point, or any bearing that the subject might be approaching, which is tedious and not what I want to achieve.
Lower illustration shows what I'd wish to achieve - achieve the trigger criteria only if approaching the destination from certain "bearings"...if that's the right way to phrase it. Hope someone understands what I'm trying to do, if you have some pointers where to start looking and if this can even be achieved on Arduino - do let me know :) Thanks a lot
-
1it's just geometry ... not really about arduinojsotola– jsotola11/26/2022 02:16:21Commented Nov 26, 2022 at 2:16
-
Perhaps I phrased the question wrong - so it is possible that arduino could detect proximity to a set destination without making a "redundant" circle due to distance radius? Would this be something on the geometry side, or on GPS library side, for example - if location is 100m from the target with the appropriate bearing - then trigger.Varonne– Varonne11/26/2022 02:26:08Commented Nov 26, 2022 at 2:26
-
so, you want the proximity alert to be valid only if you are walking on a road, for examplejsotola– jsotola11/26/2022 02:36:17Commented Nov 26, 2022 at 2:36
-
1Maby reading this (my similar question) will be useful for you : arduino.stackexchange.com/questions/91196/… and also this one for proximity trigger arduino.stackexchange.com/questions/91247/…Curious guy– Curious guy11/26/2022 08:13:05Commented Nov 26, 2022 at 8:13
-
1Note, that you actually don't need specific bearings, but little cones around these bearings, since the position will have some noise in itchrisl– chrisl11/26/2022 10:37:28Commented Nov 26, 2022 at 10:37
1 Answer 1
Before suggesting a possible solution consider these aspects of the problem:
- The question assumes a "flat earth". For small distances this assumption likely contributes an error that can be ignored. For larger distances consider calculating the great circle distance.
- Consider not every GPS module populates all NMEA fields. If bearing is supplied consider it is not valid unless the GPS module has moved more than the current accuracy of that GPS module.
While the criteria is simple (only alarm when approaching a given latitude and longitude (or MGRS coordinate) while traveling on a certain bearing), the implementation can be troublesome and / or tedious. Consider noise. The position of the GPS module might vary 10 meters while stationary. Resulting in a false bearing. The person carrying the GPS may not walk a straight line. This additional noise may result in never raising an alarm. If the GPS is carried in a car, roads may not exist for direct travel to the given latitude and longitude. Again, the alarm may never be given.
As it turns out, the assumptions made here indicate bearing is not a good criteria when determining direction of approach to a given latitude and longitude. Rather, it may be simply the relation between the current latitude and longitude and the given latitude and longitude that offers the best solution.