![]() |
2010-03-15
, 22:55
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#2
|
![]() |
2010-03-15
, 22:58
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#3
|
![]() |
2010-03-15
, 23:14
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#4
|
![]() |
2010-03-15
, 23:18
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#5
|
Yes! I got nan or 37.08 all the time.
What do you mean with speciffic gps connection?
![]() |
2010-03-15
, 23:33
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#7
|
![]() |
2010-03-15
, 23:42
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#8
|
![]() |
2010-03-16
, 00:06
|
Posts: 217 |
Thanked: 20 times |
Joined on Jan 2010
|
#9
|
cat speed.py
import location
import gobject
def on_error(control, error, data):
print "location error: %d... quitting" % error
data.quit()
def on_changed(device, data):
if not device:
print "no device"
return
if device.fix:
if device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
print "lat = %f, long = %f" % device.fix[4:6]
#data.stop()
else:
print "no fix 1"
else:
print "no fix"
def on_stop(control, data):
print "quitting"
data.quit()
def start_location(data):
data.start()
return False
def get_speed(device, data):
if not device:
return
if device.fix:
if device.fix[1] & location.GPS_DEVICE_SPEED_SET:
print "Speed %s Km/h" % device.fix[11]
#data.stop()
#i = 0
loop = gobject.MainLoop()
control = location.GPSDControl.get_default()
device = location.GPSDevice()
control.set_properties(preferred_method=location.METHOD_GNSS,
preferred_interval=location.INTERVAL_1S)
control.connect("error-verbose", on_error, loop)
device.connect("changed", on_changed, control)
device.connect("changed", get_speed, control)
control.connect("gpsd-stopped", on_stop, loop)
gobject.idle_add(start_location, control)
loop.run()
~ $ python speed.py
lat = -34.586280, long = -58.408385
Speed 3.348 Km/h
lat = -34.586278, long = -58.408383
Speed 3.348 Km/h
lat = -34.586301, long = -58.408358
Speed 2.772 Km/h
lat = -34.586307, long = -58.408351
Speed 2.772 Km/h
lat = -34.586303, long = -58.408354
Speed 0.468 Km/h
lat = -34.586299, long = -58.408353
Speed 0.468 Km/h
lat = -34.586303, long = -58.408344
Speed 3.996 Km/h
lat = -34.586304, long = -58.408335
Speed 1.656 Km/h
lat = -34.586297, long = -58.408338
Speed 2.16 Km/h
lat = -34.586293, long = -58.408339
Speed 0.468 Km/h
lat = -34.586263, long = -58.408375
Speed 0.324 Km/h
lat = -34.586243, long = -58.408394
Speed 0.108 Km/h
lat = -34.586228, long = -58.408405
Speed 0.648 Km/h
lat = -34.586205, long = -58.408417
Speed 0.864 Km/h
lat = -34.586193, long = -58.408416
Speed 0.324 Km/h
lat = -34.586190, long = -58.408416
Speed 0.252 Km/h
lat = -34.586185, long = -58.408416
Speed 0.396 Km/h
lat = -34.586179, long = -58.408416
Speed 0.324 Km/h
lat = -34.586174, long = -58.408418
Speed 0.324 Km/h
lat = -34.586172, long = -58.408418
Speed 0.396 Km/h
lat = -34.586169, long = -58.408418
Speed 0.756 Km/h
lat = -34.586170, long = -58.408418
Speed 2.772 Km/h
lat = -34.586171, long = -58.408417
Speed 2.628 Km/h
lat = -34.586177, long = -58.408421
Speed 4.932 Km/h
lat = -34.586196, long = -58.408428
Speed 8.424 Km/h
lat = -34.586230, long = -58.408443
Speed 15.048 Km/h
lat = -34.586275, long = -58.408481
Speed 22.392 Km/h
lat = -34.586317, long = -58.408514
Speed 21.024 Km/h
lat = -34.586373, long = -58.408556
Speed 26.82 Km/h
lat = -34.586445, long = -58.408612
Speed 35.316 Km/h
lat = -34.586518, long = -58.408705
Speed 43.092 Km/h
lat = -34.586631, long = -58.408774
Speed 50.796 Km/h
lat = -34.586740, long = -58.408851
Speed 48.564 Km/h
lat = -34.586834, long = -58.408923
Speed 44.352 Km/h
lat = -34.586914, long = -58.409000
Speed 40.068 Km/h
lat = -34.587010, long = -58.409057
Speed 43.164 Km/h
lat = -34.587091, long = -58.409102
Speed 43.164 Km/h
lat = -34.587155, long = -58.409140
Speed 43.164 Km/h
lat = -34.587239, long = -58.409203
Speed 36.684 Km/h
lat = -34.587313, long = -58.409279
Speed 35.568 Km/h
lat = -34.587394, long = -58.409336
Speed 36.252 Km/h
lat = -34.587486, long = -58.409389
Speed 39.528 Km/h
lat = -34.587582, long = -58.409450
Speed 41.832 Km/h
lat = -34.587711, long = -58.409454
Speed 41.22 Km/h
lat = -34.587794, long = -58.409487
Speed 41.22 Km/h
lat = -34.587870, long = -58.409542
Speed 34.236 Km/h
lat = -34.587968, long = -58.409550
Speed 34.236 Km/h
lat = -34.588051, long = -58.409541
Speed 22.068 Km/h
lat = -34.588103, long = -58.409549
Speed 22.068 Km/h
lat = -34.588144, long = -58.409555
Speed 15.012 Km/h
lat = -34.588189, long = -58.409553
Speed 18.072 Km/h
lat = -34.588201, long = -58.409586
Speed 13.86 Km/h
lat = -34.588154, long = -58.409622
Speed 16.56 Km/h
lat = -34.588097, long = -58.409685
Speed 27.288 Km/h
lat = -34.588049, long = -58.409739
Speed 27.288 Km/h
lat = -34.588010, long = -58.409780
Speed 27.288 Km/h
lat = -34.587981, long = -58.409811
Speed 27.288 Km/h
lat = -34.587957, long = -58.409836
Speed 27.288 Km/h
lat = -34.587937, long = -58.409857
Speed 27.288 Km/h
lat = -34.587922, long = -58.409870
Speed 27.288 Km/h
lat = -34.587922, long = -58.409870
Speed 27.288 Km/h
![]() |
2010-03-16
, 00:13
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#10
|
import location
import gobject
def on_error(control, error, data):
print "location error: %d... quitting" % error
data.quit()
def on_changed(device, data):
if not device:
return
if device.fix:
if device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
print "lat = %f, long = %f" % device.fix[4:6]
#data.stop()
def on_stop(control, data):
print "quitting"
data.quit()
def start_location(data):
data.start()
return False
def get_speed(device, data):
if not device:
return
if device.fix:
if device.fix[1] & location.GPS_DEVICE_SPEED_SET:
print "lat = %f, Speed %s Km/h" % device.fix[speed]
on_changed
#data.stop()
#i = 0
loop = gobject.MainLoop()
control = location.GPSDControl.get_default()
device = location.GPSDevice()
control.set_properties(preferred_method=location.METHOD_USER_SELECTED,
preferred_interval=location.INTERVAL_DEFAULT)
control.connect("error-verbose", on_error, loop)
#while i < 2:
#device.connect("changed", get_speed, control)
device.connect("changed", on_changed, control)
#print i,
# i = i + 1
control.connect("gpsd-stopped", on_stop, loop)
gobject.idle_add(start_location, control)
loop.run()
I have read:
http://pymaemo.garage.maemo.org/pyth...ual/index.html
http://wiki.maemo.org/PyMaemo/Using_Location_API
I can not get the speed.
My goal is to create a table with speed captured every 1 second, preferently, every 0,1 if it is posible.
I can not full understand how loop works, is it a eternal loop?
I will be more than happy only with someone pointing me in the right direction.
Thanks