Pages: [1]   Go Down
Author Topic: vehicle must drive on gps  (Read 353 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,

I have already a vehicle that drives very good with the arduino mega 2560.
The next step in my project is to drive the vehicle on a gps that communicates with the arduino.
Suppose that the arable land in the form is of a trapezium and that I have the coordinates of the 4 corners.
The goal of my project is to assure that the vehicle stays in the trapezium.
Is there someone who can help me with that?
To give me some code and tell me which GPS is the most suitable for this?
I want to excuse me that my English isn't very well.
I understand everything, but I'm not good in writing.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6935
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any requirement of accuracy? Ordinary gps has accuracy in order of meters. Is that good enough? How large is this area you need to stay within? Also how fast do you have to achieve on vehicle speed?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The large of the area is about 220m at 40m, so an accuracy in order of meters is enough.
The maximu speed of the vehicle is 6 km/hour, but the average speed is 3km/hour.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 65
Posts: 6935
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you just enter the GPS coordinates of the 4 corners of the location and tell the vehicle to stay within the area? Do you need help with the math?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know the four coördinates of the area.
1) 50.92148, 3.74583      
    N 50 55.289, E 3 44.75
    N 50 55 17.3, E 3 44 45
    39589, 327042   

1) 50.92319, 3.74388
    N 50 55.391, E 3 44.633
    N 50 55 23.5, E 3 44 38
    39456, 327236

1) 50.92301, 3.74340      
    N 50 55.381, E 3 44.604      
    N 50 55 22.8, E 3 44 36.2      
    39422, 327216

1) 50.92136, 3.74522      
    N 50 55.282, E 3 44.713      
    N 50 55 16.9, E 3 44 42.8      
    39546, 327030

==> see the attach with all the information

* GPS_version1.docx (280.23 KB - downloaded 7 times.)
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46253
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Determining whether a point (the vehicle's current location) is inside a closed boundary, or not, is trivial. Define a line through the current point. The direction of the line doesn't matter, so pick an easy direction. Intersect the line and the closed boundary segments.

Order the resulting points so that they are in the same direction along the line. For a closed polygon, you should always have exactly 2 non-coincident points, so the order doesn't really matter.

Define two vectors, then, from the first intersection point to the current location, and from the first intersection point to the second intersection point. Compute the angle between the vectors. If the angle is 0, the point is inside the polygon. If the angle is 180 degrees the current location is outside the polygon.
Logged

Pages: [1]   Go Up
Jump to: