Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 12:36:47 12:36


Login with username, password and session length


Pages: [1]
Print
Author Topic: GPS Laptimer Code  (Read 2817 times)
0 Members and 1 Guest are viewing this topic.
tim2100
Inactive

Offline Offline

Posts: 3

Thank You
-Given: 8
-Receive: 0


« on: March 25, 2013, 03:29:34 15:29 »

A long shot but, Has anybody got any C project code for assisting me writing a GPS Laptimer for a Pic?

Thanks in advance.
Logged
FTL
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 170
-Receive: 33


« Reply #1 on: March 25, 2013, 06:57:40 18:57 »

As usual, a lot more information is required to provide you with specific help.

How large are your laps, how quickly are you moving, how much accuracy are you looking for?

This is relevant because GPS data is not 100% accurate. You may need to resort to a differential GPS system if you are looking for high accuracy. If the track is small is relation to the GPS error (30-50 footish), you may have issues with identifying when you are crossing the finish line.

In most cases you would be dealing with a NEMA data stream from the device with updates once to several times a second. If you are looking for sub-second accuracy, you must use a point before and after the finish line and extrapolate the position between GPS readings based on the velocity. Note that at the end of a race, a linear exptrapolation may not be very good as the moving object will often suddenly slow down immediately after crossing the finish line.

Most GPS errors are relatively slow-changing, so a differential between sequential positions is quite accurate, but it will all tend to drift over a course of minutes to hours.
Logged
tim2100
Inactive

Offline Offline

Posts: 3

Thank You
-Given: 8
-Receive: 0


« Reply #2 on: March 25, 2013, 11:03:10 23:03 »

Thanks FTL.

I'm looking at 1-2 min laps.  and I have a GPS chip and PIC board setup.  I have got the GPS chip working to pickup a GPS Signal and report the position.  So I have a NEMA data stream. 

I'm struggling with the code to pickup the laptiming and signal that a lap is completed.
Logged
FTL
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 170
-Receive: 33


« Reply #3 on: March 26, 2013, 06:47:11 18:47 »

If I were doing it, I would be thinking of defining some stuff in an XY plane. (lat-long actually, but XY is earier).

You need to define a short line somehow that defines the start/finish line. You can't use a point because you may never cross the line at exactly the same place and so would not see a lap being completed. Maybe the line could be defined as a line perpendicular to the line created by the fist couple of points you receive from the GPS after pressing a start button. The line might be 100 feet long (50 feet on each side) centered on the first point you get from the GPS after start is pressed. This should work if the user pressed start as they crossed the line the first time and in motion.

Then, whenever you get a new point from the GPS, create a line from the last point to this point, and see if it crosses the S-F line you defined above.

To make the calculations easy, I would convert each Lat-Long received from the GPS into a pseudo UTM kind of location (meters or maybe centimetelers from a certain point). That way, each of these lines could be defined as XY start and end points that are simple integers.

If you detect a crossing, you might want to be sure it is in the correct direction (you might be moving down the back straight that could be quite close to the starting point), then you need to see how far along the movement line you crossed the SF line. that can be used to extrapolate the time the crossing actually occured. You might need to do a similar extrapolation to determine the place of the oginal SF line as it will be somewhere between the GPS point immediately before and immediately after the start button was pressed.

Sorry this isn't code, but hopefully it will give you some ideas.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC