[PD] PDA PD + GPS
rat at telecoma.net
rat at telecoma.net
Thu Feb 12 09:00:11 CET 2004
hi nick,
thank u for your modification :-) .
i m not at all an experienced
scripter/programmer as u could see
- but it worked.
what could i use instead of the "evil" killall -9 ?
best
erich
----------------------------------
http://randomseed.org
On Thu, 12 Feb 2004, Nick Morrison wrote:
> On Thu, 2004-02-12 at 03:18, rat at telecoma.net wrote:
> > >
> > > 2) Has anybody seen a way to get information from a GPS device into PD?
> > >
> > i use gpsd for the gps and as there is no
> > tcpip object in pd where one can send and
> > listen from to the same port i get the data into pd with the following
> > shellscript (which i call with giges shell object):
> > ----------
> > #!/bin/sh
> > echo "x;" | nc localhost 2947 > ./data.txt &
> > cat ./data.txt | nc localhost 3002 &
> > sleep 0.1
> > killall -9 nc
> > ----------
> > the x is an option i build into gpsd to
> > just send "lat long alt speed".
> > i then use a netreceive 3002 in the patch to listen to for the data.
>
> Hi Erich,
>
> At a quick glance, it seems your script would be better written thusly:
>
> #!/bin/sh
> echo "x;" | nc localhost 2947 | nc localhost 3002 &
> sleep 0.1
> killall -9 nc
>
> I think there's no need for the intermediate data.txt. If you want to
> chain commands together, you should use '&&' instead of '&' - '&&' tells
> sh to only continue to the next command if the errorlevel of the
> previous command is 0. A single '&' causes the first process to be run
> in the background and the second process to run immediately, which could
> lead to reading from the file before it is written, which is probably
> not what you want. (ie, if the connect takes a long time for some
> reason, there'll be old data in data.txt)
>
> Forgive me if I'm barking up the wrong tree!
>
> The 'killall -9' at the end is a bit evil...
>
>
> Nick :-)
>
> --
> Nick Morrison <nickm at internode.com.au>
> Network Operations Group, Internode
>
> Proud to be the major sponsor of the Adelaide Fringe
>
More information about the Pd-list
mailing list