NMEA , request for real live sample

NMEA , request for real live sample

Post by Bino Oetom » Thu, 10 May 2007 16:10:08


Dear All ...
Is there any easier to understand sample of ruby nmea parser (
http://www.yqcomputer.com/ ) ??

I need to parse NMEA , and re format it to YAML.
I tried to :

---START---
require 'serialport'
require 'nmea'
@sp = SerialPort.open("/dev/ttyS1", 4800, 8, 1,
SerialPort::NONE)
@handler = NMEAHandler.new
while(@sentence = @sp.gets) do
puts NMEA.scan(@sentence, @handler)
end
---STOP---

but it only print "nil"

I thought that my system is not well wired, so I make a test using
miniterm.rb from the serialport library, and here is the result
---start---
[root@kannel test]# ruby ./miniterm.rb 1 4800 8 1
$GPRMC,135444,A,3815.4477,N,02349.5804,E,10412.9,243.3,090507,5,E,A*B
$GPRMC,135446,A,3810.5221,N,02344.4003,E,11501.1,219.6,090507,5,E,A*B
$GPRMC,135448,A,3803.9503,N,02341.4152,E,12561.9,199.7,090507,5,E,A*B
---stop----

Note : My test system is
1. GPS Feed : Using a PC running GPSFeed+
2. Ruby on the other Linux PC
3. The two PC is connected via a null-modem cable.

Sincerely
-bino-

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by Max Lapshi » Thu, 10 May 2007 17:48:57


You see, this NMEA sentence differ from what I assumed to be standard.
There is unknown checksum in the end. I can modify parser so, that it
would
accept such unnatural sentences, but it is very, very strange for me.
What GPS device do You use? I wish to look at it documentation, perhaps
I've missed something in standart.


Regarding NMEA.scan, it will never return anything. It can only call
method
rmc on NMEAHandler.

--
Posted via http://www.yqcomputer.com/

 
 
 

NMEA , request for real live sample

Post by Max Lapshi » Thu, 10 May 2007 18:27:33

Look at release 0.2

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by bino_oetom » Thu, 10 May 2007 18:36:36

Dear Max and all
----- Original Message -----
From: "Max Lapshin" < XXXX@XXXXX.COM >
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" < XXXX@XXXXX.COM >
Sent: Wednesday, May 09, 2007 3:48 PM
Subject: Re: NMEA , request for real live sample




It's not "real GPS" ...
It's a windows pc running gpsfeed software from -->
http://www.yqcomputer.com/
From my table, I can not get GPS signal .. thats why i use such "emulator"

Regards
-bino-
 
 
 

NMEA , request for real live sample

Post by Max Lapshi » Thu, 10 May 2007 19:18:31


Understand. According to
http://www.yqcomputer.com/ ~gnb/gps/nmea.html#gprmc, this software
violates standard, that is why it was not parsed.

Now it is parseable, but checksum correction is disabled.

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by Bino Oetom » Fri, 11 May 2007 09:48:44


Thanks Max.
So .. I need to find my GPS ... lying somewhere in my workshop

BTW .. Can you give me another sample script ?
Maybe a script that print out each variables ?

Thanks in advance

-bino-

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by Max Lapshi » Fri, 11 May 2007 13:43:25

require 'test/mocks'

class NMEAHandler
def rmc(*args)
puts args.inspect
end
end


You will not receive anything, unless NMEA handler locate Latitude
class, so You should include mocks.rb, unless You have anything better.

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by Bino Oetom » Fri, 11 May 2007 15:47:09

Dear Max.
Thanks for the response
First I make a subdirs inside ruby lib , with the name "nmea"
And make a copy of your mocks.rb into it

I try this :
---Start---
require 'serialport'
require 'nmea'
require 'nmea/mocks'
class NMEAHandler
def rmc(*args)
puts args.inspect
end
end
@sp = SerialPort.open("/dev/ttyS1", 4800, 8, 1, SerialPort::NONE)
@handler = NMEAHandler.new
while(@sentence = @sp.gets) do
@handler.rmc(@sentence)
end
---Stop----

And it produced :
["$GPRMC,134632,A,0004.3300,N,00004.3300,W,005.0,315.0,100507,000.0,W*76\r\n"]

Kindly please show me how to ... i.e "puts" just a single "latitude".

Sincerely
-bino-

--
Posted via http://www.yqcomputer.com/
 
 
 

NMEA , request for real live sample

Post by Max Lapshi » Fri, 11 May 2007 16:49:12

Look at the test/mocks.rb

class NMEAHandler
def rmc(time, latitude, longitude, speed, course, magnetic_variation)
.

thus You can get latitude

--
Posted via http://www.yqcomputer.com/