Jump to content

Build your own GPSr


Geofellas

Recommended Posts

Have you ever wanted to include instructions in your cartridge to navigate to a particular set of coordinates?

 

Have people complained that they need to save the cartridge, use their GPSr to get there, and then restart the game again?

 

I have experienced this situation in play using the Colorado - either I had to save the game and later restart it, worrying that I might miss something along the way, or use a separate GPSr to navigate to a waypoint.

 

Well, I have developed a mechanism to provide the player with much of the functionality of a GPSr from right within the cartridge itself.

 

Version 0.1 of "Build your own GPS" is available for field or emulator testing at http://www.Wherigo.com/cartridge/details.a...6d-b16f48b79597

 

In this cartridge the player is given an item (a GPS !!) with which they can ask where they are, mark waypoints (i.e., where they are), create waypoints (elsewhere), navigate to waypoints, and delete unwanted waypoints. A waypoint is implemented as a very small zone that is active and visible everywhere and so appears in the "Locations" list immediately on creation or on selecting it from the "Go To" list. To conserve processor power only one such waypoint can be active and visible at any one time.

 

Please try to break it, find areas I could improve, provide other suggestions etc.

 

When I am comfortable with it I do plan to release the source code as I think it provides a useful feature for everyone and demonstrates some useful techniques.

 

I do plan to add waypoint projection and dealing with poor/no GPS reception - I anticipate a number of updates and will advise here when/if they occur

 

Thanks for your interest

Link to comment

Here's an idea to make your cartridge even more popular: build in coordinate averaging. Once the averaging event is triggered, have an interval timer fire every second, get the player's current position, and put it into a weighted average. It'll take some thought and consideration as to how to determine the average's accuracy, but I really can see demand for this if it's done well.

 

After all, the Colorado doesn't include averaging... (and will we ever see Garmin implement the feature?)

Link to comment

This is Fantasitc, I am trying it on my PDA right now.

 

I have noticed 1 bug, it crashes when you project, create or average a waypoint, Message: Lua Error ...51-4c18-b8bc-cafb16bd35f3/Build your own GPS-new.enc: attempt to index field '?' (a nil value), then the option to exit the application.

 

It happened when I projected 1000m at 90 from my location S27 24.929 E152 56.727, after entering "test" as the WP name

 

And when I averaged for 1min after I tried to enter a name for the WP.

 

This error also happened after trying to create a WP, again after I entered a name.

 

I am running an iPAQ H2200 and a leadtek bluetooth GPS, and have run several cartridges before without problem. I notice the same problem using the emulator. I have a saved cartridge with 1 saved WP, which worked OK.

 

Further testing, it only occurs when you try to create, project, mark, etc a WP on a saved cartridge, that has a saved WP.

 

Also, not a bug, but I tired to copy and paste coordinates from GPXview, but you need to edit out the degrees symbol and spaces. Might be good if it could be a bit more flexible in the coorindates entry.

 

:lol:

 

Thanks

Tony

Edited by totalube
Link to comment

This is Fantasitc, I am trying it on my PDA right now.

 

I have noticed 1 bug, it crashes when you project, create or average a waypoint, Message: Lua Error ...51-4c18-b8bc-cafb16bd35f3/Build your own GPS-new.enc: attempt to index field '?' (a nil value), then the option to exit the application.

 

It happened when I projected 1000m at 90 from my location S27 24.929 E152 56.727, after entering "test" as the WP name

 

And when I averaged for 1min after I tried to enter a name for the WP.

 

This error also happened after trying to create a WP, again after I entered a name.

 

I am running an iPAQ H2200 and a leadtek bluetooth GPS, and have run several cartridges before without problem. I notice the same problem using the emulator. I have a saved cartridge with 1 saved WP, which worked OK.

 

Further testing, it only occurs when you try to create, project, mark, etc a WP on a saved cartridge, that has a saved WP.

 

Also, not a bug, but I tired to copy and paste coordinates from GPXview, but you need to edit out the degrees symbol and spaces. Might be good if it could be a bit more flexible in the coorindates entry.

 

:laughing:

 

Thanks

Tony

 

Thanks

 

There is a bug with saving and resuming which would do what you describe - I hope to publish an update today to fix that - just in final testing mode

 

There is a problem with degrees symbols which is why I don't include them - they don't seem to be handled consistently across platforms and trying to handle them is probably going to cause more problems than it would solve -see this thread

 

Also I have found with version 2.7 of the Colorado firmware that I cannot enter an entire coordinate string due to input field size limitations so I am going to have to redesign that entire input. :lol:

Link to comment

Version 1.7 of "Build your own GPSr" is now available

 

Version 1.7 fixes a problem with saving and restoring, which lost waypoint information. Better handling of poor accuracy preventing you from doing silly things. Note there may be an issue with creating new waypoints on the Colorado with firmware 2.7 - there seems to be a limit on input text string length that wasn't there before - that will be addressed in the next release.

Link to comment

Would it also be possible to add fitness functions for the heart rate monitor through a Wherigo cartridge? That would be pretty interesting also.

 

I would need to get info on what functions are available from the Wherigo library in order to do that (if it were even posible) - and that information is not forthcoming. Pretty much all the fancy stuff in this cartridge is the result of combing through exisiting code that TPTB have released and figuring out what it does, partly by experimentation :lol:

Link to comment

I can tell you with some certainty you won't be able to access much else on the GPSr--especially the heart rate monitor. From what I've seen said in the forums, especially early on, Wherigo has not been given access to too much on the GPSr. I doubt that will change.

 

I should also point out Groundspeak is interested in developing features that can be used across almost all Wherigo-enabled devices. They will not develop for a feature only offered on one or two GPS receiver models. Yes, Wherigo is only available on two devices at the moment--PPC and two Garmin receivers--but the idea is to have Wherigo on any GPS-enabled device: cell phones, iPhone, Palms, Magellan GPS receivers, etc.

 

I really do agree with the sentiment: it would be a Really Good Idea for Groundspeak to release documentation (or even a list) of all public methods callable from a cartridge.

Link to comment

Is it possible that with entering a waypoint you could create a new zone?

 

That is exactly how it works.

 

Creating a new waypoint, either using "mark", "create" or "average" creates a new, very small, zone. (If you want to know the gory details it is an equilateral triangle with each apex 10 ft from the entered coordinates at bearings of 0, 120 and 240 degrees true)

 

Only the latest one created is visible in the "Locations" list (for performance reasons), however every waypoint created is still "there" but inactive and invisible until you "Goto" it, at which time it becomes the only "waypoint" (i.e. zone) in the locations list.

 

Am I misunderstanding your question?

Link to comment

the player inputs a wp. Can i let things happen in that zone?

 

You certainly can but, because it is a very tiny zone, I would suggest creating a larger zone and then moving it so it surrounds the location that the user creates. This starts to get a bit tricky and definitely cannot be done in the builder although you will need to create the infrastructure for it in the builder. This is certainly an "advanced" technique.

 

You can modify the technique to do whatever you want I suppose, changing the code for waypoint creation (when I finally decide to release it - which I SHALL when I am happy with it) to perform whatever your imagination dictates (within the limits of the Wherigo functionality, of course - it will NOT tell you next week's winning lottery numbers!!)

Link to comment

I discovered your cartridge a couple of days ago and really love the idea of adding missing functionality to my Garmin Oregon using a Wherigo Cartridge. Therefore I started to play around with the Builder yesterday and really found the lack of documentation very disturbing.

 

Now I have the following questions:

 

1.) Do you plan on making your cartridge open source or would you be willing to send the lua code to interested people via email?

 

2.)Do you know of anything like a list of all (or at least some) Wherigo built in functions? What functions are there, which features of the GPS device can be accessed via lua? If there is no such list, would you mind listing all the built in functions you used in your cartridge?

 

3.) If I intend to add my own functions using a Wherigo cartridge, should I write a new cartridge or could I just contribute to your cartridge? In particular, I was thinking about adding some features of the Garmin Forerunner to my Garmin Oregon. I thought about starting with easy functions like recording and displaying the time I needed for the last kilometer while running (i.e. after each kilometer I ran the Oregon would display the time needed for the last kilometer and maybe additional information like how much faster or slower I'm running as compared to a predefined time). This could then e.g. be used for things like keeping track of my time while trying to run a half-marathon in a given time...

 

Any help would be appreciated.

 

Again thanks for having that great idea :laughing:

Link to comment

Thanks for your help. Did some research in the forum and built a very first version of my Oregon ForeRunner :P

 

Here's a list of some useful functions which might save some other newbies some time:

 

Get the location of the player:

Player.ObjectLocation

Player.ObjectLocation.latitude

Player.ObjectLocation.longitude

 

Display variables in Message boxes:

[[Location: ]] .. tostring(Player.ObjectLocation)

[[speed: ]] .. string.format("%.2f",mydist/mytime) .. [[ km/h]]

 

Get distance between two points:

local d = Wherigo.VectorToPoint(Player.ObjectLocation, tmppt)

print(d("m"))

print(d("ft"))

print(d("mi"))

print(d("km"))

where tmppt is an ObjectLocation stored earlier as e.g. in:

tmppt = Player.ObjectLocation

 

Once I figure out how to actually prevent logging in cartridges which are compiled by the Wherigo webpage I will publish the cartridge...

Link to comment

Apologies if this has been asked elsewhere, I've poked around but couldn't find anything so I'll ask the question.

 

A common complaint on the Colorado and Oregon is that there is no way to do simple file management on the unit itself, some users would like load different gpx files or maps depending on their location for example. Both units have lots of storage so it is easy to have the files preloaded but there is no way to activate them on the unit without connecting to a PC -- difficult to do if you are in the field.

 

I think I know the answer but can a Wherigo cartridge access files on the filesystem of the GPS? I'm guessing this is prevented but thought I would ask to see if there might be a way to create some sort of file manager for these units.

 

Simple example:

 

Before I travel I use my PC to load three gpx files into [drive]:\Garmin\GPX:

 

file1.gpx

file2.tmp

file3.tmp

 

file1.gpx would be the only gpx file loaded initially. A simple Wherigo file manager application could rename files like file1.gpx to file1.tmp to remove the items in that gpx file in the field. Similarly file2.tmp could be renamed to file2.gpx to activate it.

 

GO$RS

Link to comment

Wow, great idea! Unfortunately I don't have any time to investigate that at the moment but here's an idea of how it might work:

 

According to the Builder-Wiki

http://wherigobuilder.wikispaces.com/Globals

one has access to "os", the standard Lua library of operating system methods.

 

This might make it possible to use

os.rename(oldFileName, newFileName)

somewhere in the Author Script section.

 

I might be able to try this out at the weekend. If anybody is able to do it earlier I'd be interested in whether it worked :laughing:

Link to comment

Just had the time to play around with os.rename. I implemented a Wherigo-Cartridge which renames a file called test.gpx to test.tmp using the following code:

 

local rv, str = os.rename("test.gpx","test.tmp")

Wherigo.MessageBox{Text=[[rv = ]] .. tostring(rv) .. [[

str = ]] .. tostring(str),}

 

The cartridge compiles and works just fine using the Wherigo Emulator. If test.gpx exists and is in the same folder as the cartridge it will be renamed to test.tmp. If test.gpx does not exist a corresponding message will be displayed.

 

Playing the cartridge (i.e. calling the above code) on the Oregon, however, simply freezes the unit and it has to be restarted. Thereby the file is not renamed...

 

So unfortunately this idea doesn't work. Either because os.rename is not implemented or the Wherigo-Player doesn't have the necessary rights, I guess...

 

Anyone any ideas?

Link to comment

Just had the time to play around with os.rename. I implemented a Wherigo-Cartridge which renames a file called test.gpx to test.tmp using the following code:

 

local rv, str = os.rename("test.gpx","test.tmp")

Wherigo.MessageBox{Text=[[rv = ]] .. tostring(rv) .. [[

str = ]] .. tostring(str),}

 

The cartridge compiles and works just fine using the Wherigo Emulator. If test.gpx exists and is in the same folder as the cartridge it will be renamed to test.tmp. If test.gpx does not exist a corresponding message will be displayed.

 

Playing the cartridge (i.e. calling the above code) on the Oregon, however, simply freezes the unit and it has to be restarted. Thereby the file is not renamed...

 

So unfortunately this idea doesn't work. Either because os.rename is not implemented or the Wherigo-Player doesn't have the necessary rights, I guess...

 

Anyone any ideas?

 

That's too bad, I was hoping it might work. Any chance you could put this together in a cartridge that I could try on the Oregon?

 

GO$Rs

Link to comment

I did already try it on the Oregon (Software 2.5) and it made my Oregon crash.

 

However, I took the time to put together a cartridge and will send it to you, so you can try out for yourself (and at your own risk).

 

I will send you the original lua code, a cartridge compiled for the Oregon and an empty test.gpx file. You need to put both the cartridge as well as the test.gpx file into the Wherigo folder on the Oregon. Then simply start the cartridge, open the GPSr in the inventory and press the rename button. If everything goes well the file test.gpx should have been renamed to test.tmp.

 

This worked fine for me using the Emulator (which comes with the Builder). However, it does not work on the Oregon. In particular the Oregon will crash and freeze when pressing the rename button without the file beeing renamed.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...