|
|
2009-02-23
, 10:40
|
|
Posts: 3,841 |
Thanked: 1,079 times |
Joined on Nov 2006
|
#22
|
|
|
2009-02-23
, 19:10
|
|
Posts: 14 |
Thanked: 3 times |
Joined on Aug 2007
|
#23
|
Fanoush has posted the serial drivers you need. http://www.internettablettalk.com/fo...12&postcount=5 Just insmod them in and use gpspipe http://www.internettablettalk.com/fo...ad.php?t=20433
I forgot which chipset was more stable for me, I believe the non FTDI one was more stable.
|
|
2009-02-24
, 08:24
|
|
Posts: 384 |
Thanked: 90 times |
Joined on Mar 2008
|
#24
|
|
|
2009-07-24
, 06:24
|
|
Posts: 384 |
Thanked: 90 times |
Joined on Mar 2008
|
#25
|
#
# bearing and distance calculations together with
# locator convertions to lat/long and back
#
# some of this is nicked from 'Amateur Radio Software' by
# John Morris GM4ANB and tranlated into perl from the original
# basic by me - I have factorised it where I can be bothered
#
# Copyright (c) 1998 - Dirk Koopman G1TLH
#
# $Id: DXBearing.pm,v 1.11 2006/03/26 18:36:01 minima Exp $
#
package DXBearing;
use DXUtil;
use POSIX qw(:math_h);
use strict;
use vars qw($pi);
$pi = 3.14159265358979;
use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/ );
$BRANCH = sprintf( "%d.%03d", q$Revision: 1.11 $ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
$main::build += $VERSION;
$main::branch += $BRANCH;
# convert a qra locator into lat/long in DEGREES
sub qratoll
{
my $qra = uc shift;
my ($p1, $p2, $p3, $p4, $p5, $p6) = unpack 'AAAAAA', $qra;
($p1, $p2, $p3, $p4, $p5, $p6) = (ord($p1)-ord('A'), ord($p2)-ord('A'), ord($p3)-ord('0'), ord($p4)-ord('0'), ord($p5)-ord('A'), ord($p6)-ord('A') );
my $long = ($p1*20) + ($p3*2) + (($p5+0.5)/12) - 180;
my $lat = ($p2*10) + $p4 + (($p6+0.5)/24) - 90;
return ($lat, $long);
}
# convert a lat, long in DEGREES to a qra locator
sub lltoqra
{
my $lat = shift;
my $long = shift;
my $v;
my ($p1, $p2, $p3, $p4, $p5, $p6);
$lat += 90;
$long += 180;
$v = int($long / 20);
$long -= ($v * 20);
$p1 = chr(ord('A') + $v);
$v = int($lat / 10);
$lat -= ($v * 10);
$p2 = chr(ord('A') + $v);
$p3 = int($long/2);
$p4 = int($lat);
$long -= $p3*2;
$lat -= $p4;
$p3 = chr(ord('0')+$p3);
$p4 = chr(ord('0')+$p4);
$p5 = int((12 * $long) );
$p6 = int((24 * $lat) );
$p5 = chr(ord('A')+$p5);
$p6 = chr(ord('A')+$p6);
return "$p1$p2$p3$p4$p5$p6";
}
# radians to degrees
sub rd
{
my $n = shift;
return ($n / $pi) * 180;
}
# degrees to radians
sub dr
{
my $n = shift;
return ($n / 180) * $pi;
}
# calc bearing and distance, with arguments in DEGREES
# home lat/long -> lat/long
# returns bearing (in DEGREES) & distance in KM
sub bdist
{
my $hn = dr(shift);
my $he = dr(shift);
my $n = dr(shift);
my $e = dr(shift);
return (0, 0) if $hn == $n && $he == $e;
my $co = cos($he-$e)*cos($hn)*cos($n)+sin($hn)*sin($n);
my $ca = $co ? atan(abs(sqrt(1-$co*$co)/$co)) : $pi;
$ca = $pi-$ca if $co < 0;
my $dx = 6367*$ca;
my $si = sin($e-$he)*cos($n)*cos($hn);
$co = sin($n)-sin($hn)*cos($ca);
my $az = $co ? atan(abs($si/$co)) : $pi;
$az = $pi - $az if $co < 0;
$az = -$az if $si < 0;
$az = $az+2*$pi if $az < 0;
return (rd($az), $dx);
}
# turn a lat long string into floating point lat and long
sub stoll
{
my ($latd, $latm, $latl, $longd, $longm, $longl) = $_[0] =~ /(\d{1,2})\s+(\d{1,2})\s*([NnSs])\s+(1?\d{1,2})\s+(\d{1,2})\s*([EeWw])/;
$longd += ($longm/60);
$longd = 0-$longd if (uc $longl) eq 'W';
$latd += ($latm/60);
$latd = 0-$latd if (uc $latl) eq 'S';
return ($latd, $longd);
}
# turn a lat and long into a string
sub lltos
{
my ($lat, $long) = @_;
my $slat = slat($lat);
my $slong = slong($long);
return "$slat $slong";
}
1;
|
|
2010-05-21
, 18:39
|
|
Posts: 384 |
Thanked: 90 times |
Joined on Mar 2008
|
#26
|
#!/usr/bin/python
# gpsdll2mh.py
#
# G1OGY 20081102
#
# `gpsdll2mh.py` is a `gpsd' [http://gpsd.berlios.de] console-client which
# prints Maidenhead LOCATOR at user-determined, arbitary, even-number
# precision; (GPS precision max=52 - it gets quite silly long before that).
#
# PREREQUISITES: this program requires access to a running `gpsd' daemon
# (with a GPS receiver attached and functional).
#
# `gpsdll2mh.py` is intended for 'Rover-style' operation ( WAB, WAS, perhaps)
# so that one's 'new' locator can be sent as soon as it becomes apparant.
# It will also assist in calculating a (static) locator to a greater
# precision for microwave dish aiming purposes.
#
#
#
# Command line args are supported to select Locator precision (default=6);
# repeat frequency; server:port
#
#
# Command line (console) usage:
#
# python gpsdll2mh.py [[[precision] [repeat]] [server:port]]] <additive>
#
# like: python gpsdll2mh.py 10 30 (on a linux laptop running gpsd)
# or : python gpsdll2mh.py 10 30 192.168.1.99:2947 (on a (Windows) laptop connecting
# to linux server on standard port)
# so: 10-char locator evey 30 seconds
#
#
# Credits:
# The Lat/Long to Maidenhead part of this program is a rework of an original script by
# Dan Jacobson -- http://jidanni.org/geo/maidenhead/ ; latterly updated by Rene Kanter.
#
## lonlat2maidenhead -- long/lat to Maidenhead grid calculator not limited to 6 characters
## Created On : Sat Mar 15 03:54:08 2003
## rkanters 2004.2.20 version ll2mh
#
# Thank you, gentlemen.
#
#
# gpsdll2mh.py Program code
# -------------------------
# get modules
import re, sys, string
from time import sleep
from socket import *
# Set variables (defaults)
gpsdHost = 'localhost'
gpsdPort = 2947 # gpsd default (IANA)
gpsdCall = ['p'] # fixed gpsd command for 'position'
# print usage at default (no args) start ('cos of cheap way to do command-line args)
print '\n***********************************************************************'
print '\n',sys.argv[0],
# Ah! running with no args
if len(sys.argv)<2:
print "Running : 6-char LOC, 5 sec rptr, `gpsd' is local, default port \n"
print 'Usage:'
print ' ',sys.argv[0],'[[[LOC Precision] [Repeat delay]] [Server:port]]]\n'
# Abort!
print '\nINFO :: ** Ctrl-C to stop **\n\n'
# Ah! Now have args to chobble...
# validate the input precision value: must have an even number
if len(sys.argv)>1:
loclen=int(sys.argv[1])
if loclen<2 or loclen%2!=0:
sys.stderr.write('ERROR :: Locator precision requested must be an even number \n\n')
sys.exit(87)
else:
loclen=6 # why report only Square? (won't often change unless you're in a 'plane!)
# if only sqare is needed then '4' on cmd line
maxn=loclen/2 # program constant
# grab or set repeat value
if len(sys.argv)>2:
snooze=int(sys.argv[2])
else:
snooze = 5 # seconds
# gpsd network server
if len(sys.argv)>3:
sp = sys.argv[3].split(":")
gpsdHost=sp[0]
gpsdPort=int(sp[1])
print 'INFO :: Connecting to : ', gpsdHost,':',gpsdPort,'\n'
# Networking
# create local socket
gpsdSock = socket(AF_INET, SOCK_STREAM)
# connect to gpsd daemon
try:
gpsdSock.connect((gpsdHost, gpsdPort))
except Exception, e:
print " FATAL ERROR :: Cannot connect to `gpsd'!\n"
print "Is `gpsd' running? Is your server:port address correct?\n"
print "System message ::" , e ,'\n'
# send position query, receive response and calculate LOCATOR
# ~persevere~ if daemon is recalcitrant
try:
while 1:
for Query in gpsdCall:
gpsdSock.send(Query)
data = gpsdSock.recv(32)
if len(data)<12:
break
latlong = data[7:]
A=ord('A') # set a base value for the calcs.
# Following commented code originally allowed for manual entry of the lat/long values -
# I'll revisit this sometime so that there's a stand-alone option.
# run the prog with a switch - it sits and waits for input: LAT.###### <space> LONG.###### [CR]
# JIC the OPS have only a handheld GPS or Sat-Nav system available.
##
### while 1:
### line=sys.stdin.re adline()
### if not line: break
### ll=re.findall(r'([-0-9.]+)\s+([-0-9.]+)',line)
##
ll=re.findall(r'([-0-9.]+)\s+([-0-9.]+)',latlong)
if ll:
for x,y in ll:
lat=float(x)
lon=float(y)
else:
sys.stderr.write(sys.argv[0]+': ERROR :: Cannot determine LAT / LONG. Is ''`gpsd'' running?\n\n')
sys.exit(44)
if -180<=lon<180: pass
else:
sys.stderr.write('ERROR :: longitude must be -180<=lon<180\n\n')
sys.exit(32)
if -90<=lat<90: pass
else:
sys.stderr.write('ERROR :: latitude must be -90<=lat<90\n\n')
sys.exit(33) # can't handle north pole, sorry, [A-R]
lon=(lon+180.0)/20 # scale down and set up for first digit
lat=(lat+90.0)/10
mhloc=""
i=0
while i<maxn:
i+=1
loni=int(lon)
lati=int(lat)
if i%2:
mhloc+=chr(A+loni)+chr(A+lati)
lon=(lon-loni)*10
lat=(lat-lati)*10
else:
mhloc+=str(loni)+str(lati)
lon=(lon-loni)*24
lat=(lat-lati)*24
# print lat/long 'cos a short (<12) locator won't update much
# (unless you've got the hammer down)
print 'Lat / Long: ', latlong, 'Locator: ', mhloc, '\n' # main output
sleep(snooze) # repeat delay
# Close down
except KeyboardInterrupt: # inhibits the traceback on exit
gpsdSock.shutdown(1)
gpsdSock.close()
# returns the grid square, to the precision given, that contains the given point.
#
# TO DO
# DONE! Trap no valid GPS Data - if GPS device is unplugged gpsd continues but provides `?'
# DONE! Trap no gpsd daemon - can't connect
# Esoteric...
# keep count (and display on close) of all Fields [IO, JO, JN], Squares [JO01, IO91, JP63]
# and Sub-Squares [JO01BR, JO01HQ] traversed on the journey.
# 3 counters inside. Storage?? mySQL-Lite??
# print 'em ???
/usr/libexec/navicore-gpsd-helper& sleep 15 python gpsdll2mh.py
GPSJinni& sleep 15 python gpsdll2mh.py
|
|
2010-06-07
, 21:32
|
|
|
Posts: 12 |
Thanked: 2 times |
Joined on Oct 2008
@ SLC, UT / Bakersfield, CA
|
#27
|

|
|
2010-11-18
, 00:16
|
|
|
Posts: 670 |
Thanked: 359 times |
Joined on May 2007
|
#28
|
|
|
2011-04-15
, 08:29
|
|
Posts: 1,417 |
Thanked: 2,619 times |
Joined on Jan 2011
@ Touring
|
#29
|
http://www.digitalham.co.uk/equipmen...nalink_usb.php