Reply
Thread Tools
Posts: 246 | Thanked: 231 times | Joined on Jun 2011
#1
i'm wondering about how can i start the n900 GPS and register the raw data using a command on CLI. I would like to insert that command in a script.
Thanks
 
Posts: 1,011 | Thanked: 1,061 times | Joined on Jan 2010 @ Amsterdam, Palma de Mallorca
#2
 

The Following User Says Thank You to anthonie For This Useful Post:
Posts: 246 | Thanked: 231 times | Joined on Jun 2011
#3
Thanks for reply... i'm not sure if it's what i'm searching for... i run the python script and all i get was 2 messages that says "GPS service running" and "running on Maemo5"... Actually, what i need is a code that starts the gps unit on the n900 and store the gpsr data for future use.
Thanks again !!!
 
jedi's Avatar
Posts: 1,411 | Thanked: 1,320 times | Joined on Jan 2010 @ Tatooine
#4
The 'Complete Example' on http://wiki.maemo.org/PyMaemo/Using_Location_API this page worked for me...
__________________
May the source be with you.
 

The Following User Says Thank You to jedi For This Useful Post:
Posts: 246 | Thanked: 231 times | Joined on Jun 2011
#5
That's it !!! Now is just find a way to store all data because the x-term shows only the last ones.
Thanx Jedi !
 
jedi's Avatar
Posts: 1,411 | Thanked: 1,320 times | Joined on Jan 2010 @ Tatooine
#6
This is my script, based on the 'complete example'.

It waits for the GPS lock to be < 500 meters, then exists printing the lattitude, longitude and accuracy.

You could run this in a loop and 'record' the info using:
$ script.sh > logfile.txt
Code:
#!/usr/bin/python
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

    #Uncomment line below to show progress...
    #print "Accuracy: ",device.fix[6]," Lat/Long: ",device.fix[4:6]   
   
    if not device.fix[6] == device.fix[6]:
        return

    if device.fix[6] > 50000:
        return

    if device.fix:
        if device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
            print device.fix[4]," ",device.fix[5]," ",device.fix[6]
            data.stop()

def on_stop(control, data):
    data.quit()

def start_location(data):
    data.start()
    return False

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)
device.connect("changed", on_changed, control)
control.connect("gpsd-stopped", on_stop, loop)

gobject.idle_add(start_location, control)

loop.run()
__________________
May the source be with you.
 

The Following 3 Users Say Thank You to jedi For This Useful Post:
Posts: 246 | Thanked: 231 times | Joined on Jun 2011
#7
I just used the write function with -append instead print command. works well !
Thanks jedi !
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 19:57.