1 cog GPS parser
Thric
Posts: 109
Hi,
I know there are many GPS parsers in the OBEX, and I've used a few successfully. However one of my projects is starving me of 1 cog, I've tried http://obex.parallax.com/objects/579/ as a single cog solution; however, it doesn't work. Has anyone used this object successfully or any other 1 cog GPS parser?
Thanks
I know there are many GPS parsers in the OBEX, and I've used a few successfully. However one of my projects is starving me of 1 cog, I've tried http://obex.parallax.com/objects/579/ as a single cog solution; however, it doesn't work. Has anyone used this object successfully or any other 1 cog GPS parser?
Thanks
Comments
What rate are you collecting gps data? And what messages? I think making Perry's code work in the serial port cog shouldn't be too bad. I've got a use for this as well, so I'd be willing to help you out. The trouble comes in the timing. Depending on your messages and update rate, there may not be enough time to do everything. In my case, I know exactly what part of the second my 2 messages come. I suspect I have enough time to parse them each before the next message comes so moving them into an existing cog is possible.
Let me know....
Peter
@pgbpsu: Thanks for sharring that nifty object, thats really useful. I believe i'll just avoid Perry's code for now as I'm not that fond of getting into ASM too much. For the 4 ports in one, is there a way to recieve decimals like in the parallax serial terminal? I tired implementing a few changes with mild sucess.
@Cluso99: This is a quick run down on the cogs i'm using:
1 for the main program
1 for Servo control
1 for finding heading using Gyroscope information
1 for Floating Point math for finding the heading
1 to control the ADC converter bringing in sensor data
1 for PID control of the servos
2 for GPS
@Cluso99: Heres a basic run down of the cogs I'm using:
1 for the main program
1 for servo control
1 for PID control over the servos
1 floating point for the PID
1 for finding the heading
1 of the ADC brining sensor information for the heading
1 for the floating Point math to make the heading
2 for the GPS parser
if I use the 4 in one i can use 1 for the 4 in one and 0 for the GPS and 0 for Wireless Communication.
At 80mhz at 38400 baud, I have somewhere south of 500 operations to work with between bits. That should be plenty to do simple parsing. I woudln't expect anything fancy like floating point math though.
I use the 4 serial port object anytime I need a serial port. It's allowed me to do things with the prop that wouldn't have been possible using one cog for each (a la FullDuplexSerial).
I usually set things up like this:
Have a look at the addport method to get the details, but it's pretty much just like fullDuplexSerial, except that you have to declare which of the 4 ports you are adding/using. Then when you use the normal FullDuplexSerial methods (str for example) you simple have an additional argument, the port.
I know that many of my programs have multiple cogs sitting in repeat loops. That's a logical way to structure a program, but it can be wasteful of resources. Have a look at what your doing and see where there's "down" time. For instance, I have a gps in one of my project that outputs the NMEA message at the same portion of the second every time (between 50ms and 100ms after the 1PPS). Once I figured this out I was able to setup a repeat loop that kept track of where I was in the second, by grabbing the system counter every time the PPS line went high and comparing that to the current system counter. If I was close to the arrival of the NMEA message, I would wait for it and process it. Once it had arrived, I know I had almost 9/10ths of a second to do other things. That's where I intend to put the actual parsing of the NMEA message (although I haven't yet). In your case, maybe you can do your PID control there if once/second is fast enough for that. Just a thought....
Peter
@pgbpsu: I've got 4 in one program up and running and it works fairly well in sending strings and decimals to the parallax serial terminal, the only problem is in receiving decimals.
This is just something I tried to alter from the extended full duplex serial program as a subroutine in my main program. Its not really working, probably a careless mistake, but any pointers is appreciated.
My version (old admittedly) of FullDuplexSerial doesn't have any methods for receiving decimal strings. Could you be talking about another object?
I'll hunt around, but if there's an example to work from it shouldn't be too bad to convert that.
p
You might be referring to Martin's Extended Full Duplex Serial. It looks like a wrapper for Full Duplex Serial. I've altered Tim Moore's 4-ports-in-one-cog to include only one if Martin's functions: rxDec. If you need others, you should be able to follow that example. I didn't have an opportunity to check that it works correctly which is why I didn't do the others, but it looks pretty straight forward.
Let me know how you get on.
Peter