Community discussions

MikroTik App
 
jywmpg
just joined
Topic Author
Posts: 20
Joined: Sun May 24, 2009 10:52 pm

How to get full GPS location precision

Fri Feb 04, 2011 3:35 pm

I have several mobile platforms that each have an RB411 or RB433 equipped with a serial GPS unit (Garmin GPS18)

The GPS is used for both time sync and position location. Our time sync requirements are on the order of one second, so the serial interface is fine for our time sync. We are a bit more interested in position.

The unit reports its position in degrees and minutes with four places of precision (DDMM.MMMM)
The GPS monitor function (sys gps mon) reports position to an integer number of degree seconds (DD MM' SS'')

Is there an easy way to get the full device precision from ROS, without having to resort to special-login?

Using the special-login allows access to the device's NEMA sentences, but precludes simultaneous use by the GPS package. This requires, I think, an external script to 1) login and disable GPS, 2) special-login to grab serial data, and 3) login and re-enable GPS. I have developed such a script, but it is fairly easy to get the port in a hung state where it belongs to special-login and cannot be pried loose and re-allocated to the GPS package. Once this happens, I believe a router reboot is required to regain control of the serial port.

It would be nice if 'system gps monitor' reported fractional seconds for latitude and longitude (DD MM' SS.SS...), and simply pass the full device precision to the user. Doing so would allow me to simply use that command, instead of the external script described above. In other words, it would be good if ROS was not the limiting factor in getting the router's position.

So my questions are:

1. Am I correct about this, or can I get more lat/lon digits from ROS?
2. Is there any other way, short of router reboot, to reclaim a port from special-login once it gets wedged?

Thanks and Regards,

jw
 
jywmpg
just joined
Topic Author
Posts: 20
Joined: Sun May 24, 2009 10:52 pm

Re: How to get full GPS location precision

Wed Feb 09, 2011 7:17 pm

Perhaps I posted this on the wrong area of the forum...

To quickly restate: I have a bunch of mobile RB+WiFi+GPS units that come and go from construction zones. It would be nice to use the GPS as both a clock source, and an accurate lat/lng server for generating Google maps of the on-site unit locations (a poor man's fleet tracking)

Unfortunately, the 'sys gps mon' command does not report lat/lng with full device precision, so how to obtain that?

special-login is problematic because it is easy to wedge the serial port, which requires a reboot to unwedge.

Here is a different solution that I dismissed the first time for reasons that may appear obvious. However, lacking any other solution, it is looking more attractive.

The trick is to direct the GPS serial data to the system console, which will see them as login attempts/failures. Log the failures to disk, and you can capture the desired NEMA sentences which an external script can fetch and parse. Schedule the process to run periodically, and you have a (very) crude location server.

1. Configure sys/log to log critical errors to a small disk file
/system logging action add disk-file-count=1 disk-file-name=consoleLog disk-lines-per-file=20 disk-stop-on-full=no name=consoleLog target=disk
/system logging add action=consoleLog disabled=no prefix="" topics=critical
2. Disable GPS on the serial port
sys gps set enabled=no;
3. Enable system/console on the serial port. This causes the GPS NEMA sentences to be interpreted as (failed) login attempts
sys console set 0 disabled=no
4. Delay for 15-20 seconds, allowing time for one or more GPRMC NEMA sentences to be logged to the disk file
delay 13s
5. Disable system/console on the serial port
system console set 0 disabled=yes
5. Enable GPS on the serial port
system gps set enabled=yes
Put this in a script and schedule it to run periodically, and you end up with a log file similar to the following
Feb/09/2011 09:57:45 system,error,critical login failure for user $GPGSV,3,2,10,21,56,280,28,25,15,200,26,29,73,154,29,30,29,296,30*7E via local
Feb/09/2011 09:57:46 system,error,critical login failure for user 296,30,02,02,085,00*73 via local
Feb/09/2011 09:57:48 system,error,critical login failure for user $GPRMC,165748,A,4650.0058,N,11400.7560,W,000.0,142.0,090211,015.5,E*6A via local
Feb/09/2011 09:57:49 system,error,critical login failure for user 30,,,,,2.1,1.1,1.7*30 via local
Feb/09/2011 09:57:50 system,error,critical login failure for user 0,28,25,15,200,25,29,73,154,29,30,29,296,30*7D via local
Feb/09/2011 09:58:07 system,error,critical login failure for user 3,05,16,18,21,25,29,30,,,,,,2.1,1.1,1.7*30 via local
Feb/09/2011 09:58:08 system,error,critical login failure for user 10,25,15,200,24,29,73,154,29,30,29,296,32,02,02,085,00*73 via local
Feb/09/2011 09:58:10 system,error,critical login failure for user $GPRMC,165810,A,4650.0084,N,11400.7581,W,000.0,357.1,090211,015.5,E*61 via local
Feb/09/2011 09:58:11 system,error,critical login failure for user 8,21,25,29,30,,,,,,2.1,1.1,1.7*30 via local
Feb/09/2011 09:58:12 system,error,critical login failure for user ,10,05,36,053,38,16,21,315,29,18,22,214,23,21,56,280,29*71 via local
Feb/09/2011 09:58:14 system,error,critical login failure for user $GPRMC,165814,A,4650.0088,N,11400.7580,W,000.0,357.1,090211,015.5,E*68 via local
Feb/09/2011 09:58:15 system,error,critical login failure for user 5,29,30,,,,,,2.1,1.1,1.7*30 via local
Feb/09/2011 09:58:16 system,error,critical login failure for user ,3,2,10,25,15,200,23,29,73,154,29,30,29,296,32,02,02,085,00*74 via local
Feb/09/2011 09:58:18 system,error,critical login failure for user $GPRMC,165818,A,4650.0093,N,11400.7580,W,000.0,357.1,090211,015.5,E*6E via local
Feb/09/2011 09:58:19 system,error,critical login failure for user ,30,,,,,,2.1,1.1,1.7*30 via local
Feb/09/2011 09:58:20 system,error,critical login failure for user 5,200,23,29,72,154,29,30,29,296,32,02,02,085,00*75 via local
Feb/09/2011 09:58:22 system,error,critical login failure for user ,00*77 via local
Which can be parsed for desired GPRMC NEMA sentences easily enough with
scp -P <port> <user>@<RB>:consoleLog.0.txt tmp;cat tmp|grep GPRMC|cut -d' ' -f8
yielding
$GPRMC,165748,A,4650.0058,N,11400.7560,W,000.0,142.0,090211,015.5,E*6A
$GPRMC,165810,A,4650.0084,N,11400.7581,W,000.0,357.1,090211,015.5,E*61
$GPRMC,165814,A,4650.0088,N,11400.7580,W,000.0,357.1,090211,015.5,E*68
$GPRMC,165818,A,4650.0093,N,11400.7580,W,000.0,357.1,090211,015.5,E*6E
The lat/lng is reported as DDMM.MMMM, or a precision of 1/10,000 minute, as opposed to 'sys gps mon' which reports with a precision of one second, or 1/60 minute.

Simple, no? :?

jywmpg
 
jywmpg
just joined
Topic Author
Posts: 20
Joined: Sun May 24, 2009 10:52 pm

Re: How to get full GPS location precision

Mon Feb 14, 2011 3:47 am

Or, one could just refer to the Serial Port Usage Wiki entry at http://wiki.mikrotik.com/wiki/Serial_Port_Usage

A cleaner approach than the one I described in the previous posts is to simply use /port remote-access to send the GPS serial output to a TCP port.

Then an external machine can periodically:
1. Swap the serial port from GPS to remote-access
2. Grab the desired NEMA sentences via a simple telnet session
3. Swap the serial port from remote-access back to GPS, to drive the NTP server.


Still, in my opinion, it would be nice if /sys gps mon returned fractional degree seconds.

jw
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: How to get full GPS location precision

Mon Feb 14, 2011 8:04 am

yes, that feature request is already submitted, hopefully we will have it soon
 
jywmpg
just joined
Topic Author
Posts: 20
Joined: Sun May 24, 2009 10:52 pm

Re: How to get full GPS location precision

Mon Feb 14, 2011 4:58 pm

Thanks Normis, for the reply and for the news.

Sorry for the duplication.

jw

Who is online

Users browsing this forum: No registered users and 29 guests