Go Down

### Topic: vehicle must drive on gps (Read 610 times)previous topic - next topic

#### Joris_DP

##### Feb 01, 2013, 11:15 pm
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.

#### liudr

#1
##### Feb 02, 2013, 02:12 am
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?

#### Joris_DP

#2
##### Feb 02, 2013, 07:49 pm
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.

#### liudr

#3
##### Feb 02, 2013, 07:53 pm
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?

#### Joris_DP

#4
##### Feb 02, 2013, 08:09 pm
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

#### PaulS

#5
##### Feb 03, 2013, 01:59 am
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.

Go Up

Please enter a valid email to subscribe

To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy