GPS_Basic_spin question
w4fej
Posts: 264
I am trying to use GPS_Basic_spin and can't seem to get the results I though I would get. My super simple application is just a test app to figure out how to use the object by Jonny Mac..
This is the method from GPS_Basic I'm trying to use:
In my app I am trying to recover only the numeric version of UTC time seconds. This is how I have been trying to use it.
value := GPS.n_secs (this is in my app
I get on my display ONLY the units digits of the seconds. 0..9 and repeats. I never get the tens digits.
If I run a little test program where I manually assign a value to "value" without the GPS the digits work fine...
If I run the GPS_Basic_demo all works great with the string versions of the methods but I require the numeric version of the method. I originally thought that maybe by using two different instances of FullDuplexSerial that perhaps that was messing with my data but looking through the forum I see that multiple copies of FDS is OK.. FDS is running in the GPS object and also in the VesiGenie object to write to my display..
Do I need to provide more info here??
This is the method from GPS_Basic I'm trying to use:
pub n_secs (this is running in the GPS object) '' Seconds as decimal value, 0..59 '' -- returns -1 if gps string is invalid if (strncmp(@RMC_HDR, @rmcwork, 6) == 0) ' have gps data? return str2dec(@rmcwork[11], 2) ' yes, convert seconds else return -1 ' no, error
In my app I am trying to recover only the numeric version of UTC time seconds. This is how I have been trying to use it.
value := GPS.n_secs (this is in my app
I get on my display ONLY the units digits of the seconds. 0..9 and repeats. I never get the tens digits.
If I run a little test program where I manually assign a value to "value" without the GPS the digits work fine...
If I run the GPS_Basic_demo all works great with the string versions of the methods but I require the numeric version of the method. I originally thought that maybe by using two different instances of FullDuplexSerial that perhaps that was messing with my data but looking through the forum I see that multiple copies of FDS is OK.. FDS is running in the GPS object and also in the VesiGenie object to write to my display..
Do I need to provide more info here??
Comments
My problems is getting it to run properly with two cogs. Still working on it. This url helped me to parse the data the way I want it.
http://www.boondog.com/tutorials/gps/gps.html
checking your work: http://www.sunearthtools.com/dp/tools/conversion.php
coordinate conversion methods and types: http://www.earthpoint.us/Convert.aspx
Let me know if this helps.
Using Spin for all this. (see the attached code in my original post). My only issue is whether or not I am using that method correctly.
My app has a variable "value" defined as long and I am assigning "value" like this:
value := GPS.n_secs (UTC seconds field in numeric form, not as a string)
I get in return "value" only having the seconds digit 0..9 instead of 0..59 like I should.. In addition to my very, very simple app there are 2 objects listed, "GPS_basic.spin" and "VisiGenie.spin" both of which invoke "FullDuplexSerial" but to different pins..
I was hoping Jonny Mac would chime in here as he is the author of GPS_basic.spin..
Mike B.
I'm using the Parallax PAM-7Q GPS Module if that makes any difference. (at 9600 baud by the way) I THINK the issue might be in the "str2dec" method as I am only seeing 0..9 for the "n_secs" method if, and only if I am using that method correctly which has a high probability of me using it incorrectly due to my noob status...
Mike B.
Noob, schmoob -- I don't care about that; if there's a problem in the code I'll do what I can to sort it out. I have a reason to re-address GPS which is coming up, so I may rewrite the whole thing. I have a lot more experience with parsing the last year so I can put that experience to use.
I don't know if there is a problem in the code or not. (Knowing your work, I doubt it). I was initially asking if I was trying to get the decimal seconds into a byte variable the correct way. Like this:
value := GPS.n_secs (this line is in my test app I then send the contents of "value" to my display which results in 0..9 with no 10's digits.)
Do I simply assign n_secs to my variable??
If you're not doing anything with the numeric value (except printing), you could use the "s_" method:
Back in town and will be leaving again in a few hours.
OK. I am using the 4DSystems 3 /12" touch screen display driven by the 4DVisiGenie.spin object. It sends "messages" to the various objects on the screen like buttons, switches numeric displays etc. This page (or form as they referrer to them) has an airline arrival/departure type display. All the GPS info is displayed in 2 digit "chunks" that require 2 digit numeric data. I can't use string data.
Using your GPS object (GPS.n_secs) I have been trying to assign my variable "value" (long) like this:
Value := GPS.n_secs
Then send it to the display like this:
LCD.WriteObjValue($09,3,value)
$09 is the object type in this case a "customDigit
3 is the object number in this case it is the 4th custom digit on the screen (secs)
"value" is supposed to be the current number of seconds from the GPS object. All I am getting this way is the right most seconds, never see the tens digits. It does repeat 0..9 at the one second interval.
If I assign "value" manually with a loop limiting the value to 0..59 that works fine, just not from the GPS object.
What am missing here?? Could having "value" defined as long be tripping me up here??
Thanks for looking into this....
Mike B.
You out working on some killer animation?? (Love the pictures of some of the stuff you do, amazing)
Mike B.
On Monday (back in Los Angeles) I will be voicing an animation. Does that count? I actually had to record myself on the road last trip and send the audio to the director. It worked.
Just had a hunch on the GPS thing. If I preload the result of the "str2dec" method where it returns "dec" I preloaded "dec" with 29 and sure enough I got both digits in my display so it looks like the str2dec method has an issue or perhaps the parse routine is off by a digit...
Talk to you Monday and have a great weekend..
Mike B.
The "s_" and "n_" functions weren't working as expected for me on the PAM-7Q GPS. I was using the start method, not the startx method.
It all starting working fine when I used the startx method and set the baud to 9600.
As the documentation clearly states, the module runs at 9600. :-p
I'm running the device at 9600 with the "start" method but wasn't using the "statrx" version, I'll go check that and see if it makes any difference for the issue I am having...
Thanks..
P.S. There is an error in the AN002 GPS_Basic.spin method in the "n_altf" (altitude in feet) with the conversion from meters to feet, just change the order in which you do the division and it will compute correctly. Here is the discussion:
The method "pub n_altf" has the conversion as follows:
Return (n_altm * 3048 / 10_000)
The computation should be :
Return (n_altm * 10_000 / 3048)
To check this use this test:
10668 meters SHOULD yield exactly 35_000 feet but instead yields 3,251.6 feet
Using the other computation does indeed yield 35,000 feet.
Using the "GPS_Basic_Demo and the PST for display it works great using all the string methods. I need the numeric methods to work for my app..
As far as I can tell the issue appears to be with the "str2dec" method only returning the right most digit and I can't see what the problem is with that method.
Jonny Mac said he would take a look at it when he gets back in town...
Mike B.
I've attached the code in my personal library. Give it a try.
Do me a favor and attach an archive of what you have so I can look at it if my updated object doesn't make a difference.
Mike B.
Well still the same thing, no tens digits so now I'm sure I'm doing something wrong in my app.
for a sanity check I load "29" into one instance of the n_sec and the other from the GPS object..
You see anything obvious I am doing wrong??
By the way I see the str2dec method has changed in the current version of jm_GPS_Basic
Mike B
That may be the case. The attached image shows str2dec() in my latest object works as is is supposed to work.
Since you don't have the courtesy to post an archive of your project -- as I requested -- I am bowing out of this discussion and will ignore future posts by you.
I thought I did post my project. Guess I don't know what you mean by "archive of your project"
You may assume everyone speaks your language...
Sorry if I offended you somehow but have a nice day anyway..
Mike B.
Live and learn again.... At 71 years of age I get angry at myself if I don't learn something every day. And today I'm not angry after learning something about the Prop IDE AND people..
Mike B.
Thanks Andy, I went and tried that and it works great. Too bad I learned about so late in life...
Mike B.