code:gps2osc
no way to compare when less than two revisions
Différences
Ci-dessous, les différences entre deux révisions de la page.
— | code:gps2osc [2024/02/09 16:26] (Version actuelle) – créée - modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== gps2OSC ====== | ||
+ | discute avec gpsd et transfert les info en OSC | ||
+ | |||
+ | ===== ajout a gpsd pour le lancement et l'init du gps ===== | ||
+ | |||
+ | |||
+ | le checksum http:// | ||
+ | |||
+ | < | ||
+ | # jamming mode | ||
+ | echo -e ' | ||
+ | sleep 1 | ||
+ | # update rate 1s | ||
+ | echo -e ' | ||
+ | sleep 1 | ||
+ | # DGPS_MODE | ||
+ | echo -e ' | ||
+ | sleep 1 | ||
+ | # SBAS MODE 0=off | ||
+ | #echo -e ' | ||
+ | #echo -e ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== gps2OSC.py ===== | ||
+ | |||
+ | < | ||
+ | #! / | ||
+ | # License: GPL 3 | ||
+ | # | ||
+ | |||
+ | from gps import * | ||
+ | import threading | ||
+ | import liblo | ||
+ | |||
+ | gpsd = None | ||
+ | class GpsStream(threading.Thread): | ||
+ | def __init__(self): | ||
+ | threading.Thread.__init__(self) | ||
+ | global gpsd | ||
+ | gpsd = gps(mode=WATCH_ENABLE) # lecture ok | ||
+ | self.current_value = None | ||
+ | self.running = True # thread ok | ||
+ | |||
+ | def run(self): | ||
+ | global gpsd | ||
+ | while gpsp.running: | ||
+ | gpsd.next() #lire en boucle pour remplir | ||
+ | |||
+ | if __name__ == ' | ||
+ | try: | ||
+ | # init OSC | ||
+ | target = liblo.Address(' | ||
+ | except liblo.AddressError, | ||
+ | print str(err) | ||
+ | sys.exit() | ||
+ | |||
+ | gpsp = GpsStream() # thread | ||
+ | try: | ||
+ | gpsp.start() | ||
+ | while True: | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | liblo.send(target, | ||
+ | #print gpsd.fix.latitude,' | ||
+ | |||
+ | # print 'time utc ' , gpsd.utc,' | ||
+ | # print ' | ||
+ | # print ' | ||
+ | # print 'speed (m/s) ' , gpsd.fix.speed | ||
+ | # print ' | ||
+ | # print ' | ||
+ | |||
+ | time.sleep(1) | ||
+ | |||
+ | except (KeyboardInterrupt, | ||
+ | print " | ||
+ | gpsp.running = False | ||
+ | gpsp.join() | ||
+ | print " | ||
+ | </ | ||
code/gps2osc.txt · Dernière modification : de 127.0.0.1