0
FlyingRhenquest

I Just Pushed a C++ GPX Reader Up to Github

Recommended Posts

I've been working on some C++ libraries lately for coordinate handling and XML. I've been looking at some Android GPS trackers lately and all the ones I've looked at export to GPX format, so I've added a reader for it to my data library. This allows a C++ program to easily read such a file into a vector of lat/long coordinates. From there you could easily push your file out to a google earth object I already have in the library or whatever else you want to do with them.

I'm curious to see if the GPS tracker I'm currently playing with has enough resolution to plot a skydive. I could start logging at the beginning of the day, put the phone in airplane mode (Which won't interfere with the GPS radio,) put it in my pocket and gather GPS data for an entire day of skydiving.

Once I have the data, I can analyze it to see if I can find take-off events, aircraft exit events, canopy deploy events and landing events. I could then break the skydives out from all the other data, annotate them with times and those events and plot them on google earth. Seems like it'd be a fun little project!

If you're curious about this library, you can find it at https://github.com/FlyingRhenquest/data. The file is gpx_factory.hpp. There's a test in the test directory that shows you how to use it to populate a vector of time/coordinate pairs. All my code is licensed under the Apache 2.0 license, which allows for free use of the code with very few restrictions. I'd love to hear about it if you do something cool with it!
I'm trying to teach myself how to set things on fire with my mind. Hey... is it hot in here?

Share this post


Link to post
Share on other sites
Where's the fun in THAT? Heh heh heh.

It's really more of an excuse to keep working on the library, but it's already is pretty useful for pushing coordinate data around. It seems like there are enough people around who would just want to plot raw data on google earth with relatively little fuss. Writing some data analysis code is also kind of fun and not too hard to do.

Skydiving's a very recent hobby of mine, but bending computers to my will... well I've been doing that for decades! It still gets me going, too!
I'm trying to teach myself how to set things on fire with my mind. Hey... is it hot in here?

Share this post


Link to post
Share on other sites

I was recommending using the flysight as the GPS logger. It's accurate enough for skydiving :)
As for computers.....I started on a commodore 64 ;) although I only started programming, proper, in my mid/late teens. Never really learned C/C++ though - no practical application for it in my line of work. Java/C# pretty much only.

Performance Designs Factory Team

Share this post


Link to post
Share on other sites
Hmm. I'll check it out then! Programming is programming, more or less. Every language has the same structural components for the most part, so if you know the structures (Looping, branching, variables, pass-by semantics, etc,) the rules for good design under structural programming and how to design with objects (Design patterns and that sort of thing,) you can pick up any new language pretty easily. Except lisp. Lisp requires a moment of enlightenment.

That being said, every language also has its quirks, and although any language can be picked up pretty easily, the more you use it the better your mastery of that one particular language will be.

I think the hardest part of switching from Java to C++ would be learning the pass-by rules. In Java, all objects are passed by reference and primitive types are passed by copy. In C++ you can choose. By default everything is passed by copy and if you want to pass objects that way you must define a copy constructor so the language knows how to do it. But you can also choose to pass anything by reference (Which should feel very familiar to a Java program) or by pointer.

So far I've found that it seems to be best to define objects on the stack and pass them around by copy if you need to. The language optimizer can often eliminate the unecessary copies, and then you don't have to worry about object lifetimes so much. So if you use dynamic allocation sparingly, you don't run into the memory management problems which is what everyone complains about with C and C++. If you're not going to change an object in a function, you can make it a const reference and help the optimizer out a bit.

I really like the changes they made in the C++11 standard. I put those libraries together partially as an excuse to play with the updated language. I use in-class initialization of const variables a bit, but kind of wish they'd included the ability to do that with static variables too. I never use auto, because I like to know what every variable type is, even if it's just an iterator. The java style iteration over containers is kind of nice, but I was a bit surprised that it uses the contained element in the loop variable. I expected it to use an iterator for some reason.

The big thing I've noticed is how fast C++ is. I've converted some code from perl to C++ at work, and the speed increase in the C++ code is significant (A few seconds for the C++ code versus 10 minutes or so for the perl code.) Perl and Ruby are notorious for being slow, though. I just didn't expect them to be THAT slow.
I'm trying to teach myself how to set things on fire with my mind. Hey... is it hot in here?

Share this post


Link to post
Share on other sites

Commodore 64, eh? Fancy-Schmancy!! My 1st personal experience with "home/PC" (outside of mag-tape & punch-card mega-room-size facilities) was when I was working for Radio Shack back in '77 - and we all had to have "advanced training" on the (was gonna revolutionize the world!) TRS-80. :P

coitus non circum - Moab Stone

Share this post


Link to post
Share on other sites
Quote

Commodore 64, eh? Fancy-Schmancy!! My 1st personal experience with "home/PC" (outside of mag-tape & punch-card mega-room-size facilities) was when I was working for Radio Shack back in '77 - and we all had to have "advanced training" on the (was gonna revolutionize the world!) TRS-80. :P



My parents bought me a TI 99/4A for Christmas in 1983. You could get the machine dirt cheap that year -- TI had just discontinued the brand because of its power supply's distressing tendency to occasionally catch on fire. I taught myself BASIC, started dabbling in assembly language and took every computer course I could get my hands on at school. It seems to have served me well -- those skills are funding my skydiving hobby today!
I'm trying to teach myself how to set things on fire with my mind. Hey... is it hot in here?

Share this post


Link to post
Share on other sites
man, i was just talking the other day about how i wish i'd kept at it! i bought a ti-99/4a when i was 14 and my cousin had a ti-99/4 and we traded programs quite a bit. i still have mine but the 1 key doesn't work. i knew basic like the back of my hand, it would have been so easy back then. now i'm leaning c++. i know python and visual basic pretty well, so it's not too hard. i really miss the ease of basic, tried to find it a couple of months ago but that type of basic doesn't exist anymore. oh, well i had a lot of fun and three kids and a grand-daughter that i wouldn't trade the world for, so i guess it ain't that bad.
http://kitswv.com

Share this post


Link to post
Share on other sites
Quote

man, i was just talking the other day about how i wish i'd kept at it! i bought a ti-99/4a when i was 14 and my cousin had a ti-99/4 and we traded programs quite a bit. i still have mine but the 1 key doesn't work. i knew basic like the back of my hand, it would have been so easy back then. now i'm leaning c++. i know python and visual basic pretty well, so it's not too hard. i really miss the ease of basic, tried to find it a couple of months ago but that type of basic doesn't exist anymore. oh, well i had a lot of fun and three kids and a grand-daughter that i wouldn't trade the world for, so i guess it ain't that bad.



I found a pristine one for sale at a hamfest in the mid 90s and was tempted to buy it, but I already had too much stuff laying around the house and I knew I'd never actually use it. I think you can find emulators online for the TI 99/4A, C64, Apple 2, and some of the old video game systems. My last manager actually remembered the poke you needed to do to make the C64 screen flash all different colors.

The various scripting languages (Ruby, Python, Perl) are probably as close as you can get to the old BASIC development anymore. It's still pretty easy to develop an application in them. Javascript works reasonably well too. I'm kind of surprised Logo never took off though. With turtlegraphics it was very easy to modify your program and see what impact it'd have on the output. You could pick up some basic programming and some basic geometry at the same time.

The hardest part of programming is learning proper design of a program. Most of the programmers I've met haven't really mastered it. I got pretty good at structural design from experience -- a decade or so of writing programs will do that for you! Object oriented gave me some trouble until one of my employers sent several of the developers (including me) to a week-long class on OO Design and Design Patterns. Most of the time I think those classes are useless, but this one really helped a lot.

I find the biggest trap you can fall into is wanting to get it perfect the first time. Code never really is perfect, so I just prefer to understand the problem I'm tackling and get something on paper. Once I have a rough draft out, it's easier to see where various things belong. There's also usually an attitude that once code is down it's carved in stone and can't be changed, but really it should always be changing. As you work with it, maybe you realize you need another function somewhere or that several objects you have are similar enough that you could make a common parent and derive them all. I think this sort of maintenance is more important than writing the program originally.
I'm trying to teach myself how to set things on fire with my mind. Hey... is it hot in here?

Share this post


Link to post
Share on other sites
i learned visual basic in class along with python. it was pretty easy, but we didn't get as deep into vb as i would have liked. i had the structuring down pretty good with python, but oo programming drove me nuts. i went through a book, leanr visual basic 2010 in 24 hours, great book and you wrote a simple picture viewer program and push it out with the publisher and make an install file. i had mine out about an hour before i got the first update finished. i had the 2d and 3d updates done the next day. i love making something better. haven't had a chance to port that one over to vb yet, i'm learning c++ first. i am gonna look for those emulators for when i get some free time.
http://kitswv.com

Share this post


Link to post
Share on other sites

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.

0