[pskmail] Re: A tiny progress report regarding gps

  • From: Rein Couperus <rein@xxxxxxxxxxxx>
  • To: pskmail@xxxxxxxxxxxxx
  • Date: Sat, 10 Feb 2007 20:53:55 +0100

Hi Per,

I have been testing around a bit an d found a problem with GPS::NMEA.

below is a little test progam. It reads the gps constantly and puts the time 
and position into ~/mail/.utc

The problem is that reading the socket this way takes up to 30% of my CPU. (As 
a reference, fldigi takes 3% of may CPU).

I have also checked gpsd, and that does it with 0% CPU. I will now start some 
testing with NET::GPSD.

Here is the little test program. Even if you only want the position it takes a 
lot of CPU time:

#!/usr/bin/perl
use GPS::NMEA;
use Data::Dumper;

my $gps = GPS::NMEA->new(Port => '/dev/ttyUSB0',
Baud => 4800);

print "Starting gps\n";

while(1) {
        my($ns,$lat,$ew,$lon) = $gps->get_position;

    $data= Data::Dumper->new([$gps->{NMEADATA}],[])->Dump;
        @items = split ",", $data;
        for $utc (@items) {
                if ($utc =~ /(\d\d:\d\d:\d\d)/) { 
                        if ($ns eq "S") {
                                $ns = "-";
                        } else {
                                $ns = " ";
                        }
                        if ($ew eq "W") {
                                $ew = "-";
                        } else {
                                $ew = " ";
                        }
                        $outstring = sprintf("%s %s%s %s%s\n", 
$1,$ns,$lat,$ew,$lon);
                        `echo "$outstring" > ~/mail/.utc`;
                        print $outstring;
                        last;
                } else {
                        unlink "$ENV{HOME}/mail/.utc";
                }
        }
        select undef, undef, undef, 0.5;
} # end while

exit;


> -----Ursprüngliche Nachricht-----
> Von: pskmail@xxxxxxxxxxxxx
> Gesendet: 10.02.07 15:39:04
> An: pskmail@xxxxxxxxxxxxx
> Betreff: [pskmail] Re: A tiny progress report regarding gps


> 
> I agree, that is an absolute must.
> 
> Per
> 
> (Sunny, -10C in the sun now)
> 
> lör 2007-02-10 klockan 13:54 +0100 skrev Rein Couperus:
> > forgot, it would be nice if we could also get gps time so we can update the 
> > clock without internet...
> > 
> > Rein
> > 
> > (Sunny, 20 degrees in the shade...)
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: pskmail@xxxxxxxxxxxxx
> > > Gesendet: 10.02.07 11:58:00
> > > An: pskmail@xxxxxxxxxxxxx
> > > Betreff: [pskmail] Re: A tiny progress report regarding gps
> > 
> > 
> > > 
> > > lör 2007-02-10 klockan 10:55 +0100 skrev Rein Couperus:
> > > > Hi Per,
> > > > 
> > > > I think what we need is something we can poll from pskmail, so we can 
> > > > get the position when we want.
> > > > One way to do that is to fork a new process which does exactly what you 
> > > > did, and put the result in a file which we can read any time from any 
> > > > of the other preocesses...
> > > > 
> > > > Rein EA/PA0R/P
> > > > 
> > > Ok, that should be easy (will fix).
> > > I haven't looked at the client at all so I'll talk to you agn when I
> > > need to have some gui control of this. I suppose we can agree that we
> > > wont need gpsd if we do it this way ?
> > > 
> > > Another subject:
> > > Dave has improved fldigi dominoex, oh7jjt and I are testing dominoex16
> > > on 80 (and 40) meters now. Looks good so far, snr is really bad on 80
> > > now but I got some parts anyway (more on that as snr improves).
> > > This means I am using fldigi 1.32e and its much slower on psk than it
> > > used to be, timing could be a bit off now.
> > > 
> > > 73 de Per, sm0rwo
> > > 
> > > 
> > > 
> > > 
> > 
> -- 
> Pär Crusefalk
> Turnévägen 5
> 14243 Skogås
> Tel: +4687717482
> Mob: +46768800670
> 
> 
> 
> 
> 
> 

-- 
http://pa0r.blogspirit.com

Other related posts: