Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > NMEA , request for real live sample

Reply
Thread Tools

NMEA , request for real live sample

 
 
Bino Oetomo
Guest
Posts: n/a
 
      05-09-2007
Dear All ...
Is there any easier to understand sample of ruby nmea parser (
http://rubyforge.org/projects/nmea/ ) ??

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,2 43.3,090507,5,E,A*B
$GPRMC,135446,A,3810.5221,N,02344.4003,E,11501.1,2 19.6,090507,5,E,A*B
$GPRMC,135448,A,3803.9503,N,02341.4152,E,12561.9,1 99.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.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Max Lapshin
Guest
Posts: n/a
 
      05-09-2007
Bino Oetomo wrote:

> [root@kannel test]# ruby ./miniterm.rb 1 4800 8 1
> $GPRMC,135444,A,3815.4477,N,02349.5804,E,10412.9,2 43.3,090507,5,E,A*B
> $GPRMC,135446,A,3810.5221,N,02344.4003,E,11501.1,2 19.6,090507,5,E,A*B
> $GPRMC,135448,A,3803.9503,N,02341.4152,E,12561.9,1 99.7,090507,5,E,A*B


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.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Max Lapshin
Guest
Posts: n/a
 
      05-09-2007
Look at release 0.2

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
bino_oetomo
Guest
Posts: n/a
 
      05-09-2007
Dear Max and all
----- Original Message -----
From: "Max Lapshin" <(E-Mail Removed)>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <(E-Mail Removed)>
Sent: Wednesday, May 09, 2007 3:48 PM
Subject: Re: NMEA , request for real live sample


> Bino Oetomo wrote:
>
> > [root@kannel test]# ruby ./miniterm.rb 1 4800 8 1
> > $GPRMC,135444,A,3815.4477,N,02349.5804,E,10412.9,2 43.3,090507,5,E,A*B
> > $GPRMC,135446,A,3810.5221,N,02344.4003,E,11501.1,2 19.6,090507,5,E,A*B
> > $GPRMC,135448,A,3803.9503,N,02341.4152,E,12561.9,1 99.7,090507,5,E,A*B

>
> 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.
>


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

Regards
-bino-


 
Reply With Quote
 
Max Lapshin
Guest
Posts: n/a
 
      05-09-2007
Bino Oetomo wrote:
>
> It's not "real GPS" ...
> It's a windows pc running gpsfeed software from -->
> http://sourceforge.net/projects/gpsfeed
> From my table, I can not get GPS signal .. thats why i use such
> "emulator"


Understand. According to
http://www.werple.net.au/~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.ruby-forum.com/.

 
Reply With Quote
 
Bino Oetomo
Guest
Posts: n/a
 
      05-10-2007
Max Lapshin wrote:
>
> Understand. According to
> http://www.werple.net.au/~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.



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.ruby-forum.com/.

 
Reply With Quote
 
Max Lapshin
Guest
Posts: n/a
 
      05-10-2007
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.ruby-forum.com/.

 
Reply With Quote
 
Bino Oetomo
Guest
Posts: n/a
 
      05-10-2007
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,31 5.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.ruby-forum.com/.

 
Reply With Quote
 
Max Lapshin
Guest
Posts: n/a
 
      05-10-2007
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.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NMEA (GPS protocol) parser Max Lapshin Ruby 5 04-12-2007 09:21 AM
Bullet proof passing numeric values from NMEA data stream. Doug Gray Python 4 03-20-2007 01:53 PM
LocationProvider (JSR179) which talks to NMEA devices over serial? Simon Brooke Java 0 10-13-2006 01:46 PM
NMEA alastairlynch@gmail.com VHDL 4 02-06-2006 11:23 PM
Take UTC time from NMEA format. jjs0713 C Programming 0 07-30-2003 09:29 AM



Advertisments