Archiv der Kategorie: tech blog

Screenstory I

Hey out there,

took a long time since I posted the last progress step. We did some tests again in Bodelschwinghschule and refined collaboration functionality for the Geo activity.

We created some screenstories which tell you more about the workflow for each plugin we can provide for now (Geocaching and Geotagging). This is the first screenstory telling about the Geocaching, a later blog article will give you information about Geotagging.

First startup the Geo game and choose the Geocaching activity.


Start the Geo activity

Start the Geo activity


Choose plugin (within Geo a plugin represents the actual activity)

Choose plugin (within Geo a plugin represents the actual activity)


06-player1-placing_treasure

Hide treasure somewhere


Treasure placed

Treasure placed


Share the activity

Share the activity


Two players join activity

Two players join activity


Display treasure

Display treasure


Player I found the treasure first

Player I found the treasure first




Geocaching

For the usability test at the Bodelschwinghschule I enabled geocaching functionality for the XO. For now the geocaches are hardcoded for each laptop, though. You can display the cache by clicking the ‚Show Cache‘ button. Your position is displayed by default.

002_xo-world002_xo-show-cache

Another progress  made is to enable collaboration via the great groupthink library by Benjamin M. Schwartz (get it from its repository). It offers several shared datastructures. The new version of the Pippy activity and Arithmetic are using it already. It look very promising and I’m sure it is a very good approach to encapsulate the collaboration things a developer has to do (even though, the Hello Mesh activity gives a good example how to start with collaboration on an XO).

However, I managed to connect several XOs to let them share the geospace activity. Visulization stuff is in progress; for now only the positions of each XO user is shared, logged and updated.

003_collaboration_3003_collaboration_2

Some more screenshots

For this I’d like to present a new screenshot. As you remember the first shots were taken showing OpenLayers embedded into a gtk widget via hulahop.

Now I’d like to show a different approach using one of the great tile servers offering rendered OSM data. Have a look at implemented functions like navigation and zooming. Also note the crosshairs (showing current WGS84 lon/lat coordinates). It is also possible to jump to the current location (if GPS connection is available of course).

Crosshair and lon/lat coordinates

Crosshair and lon/lat coordinates

If GPS signal is available, jump to it by simply clicking a button.

If GPS signal is available, jump to it by simply clicking a button.

Hacknight the 2nd

As I mentioned here some results from the Hacknight we had on the 3rd of December. We were three groups (2–3 people each), one playing around with the OLPC server, another one which tryed to work out the collaboration stuff and the third one which targeted to integrate GPS positioning in the application.

Here a short summary of each group:

OLPC Server

Target was to investigate if the OLPC XS is capable to act as a Tile@Home server. Tile@Home is similar to the classic SETI@HOME where you were able to share CPU time with NASAs efforts in searching for extraterrestrial life when your computer was in idle state. Well, we’re not really  interested in extraterrestrial life (at least that night ;-)), but wondered if XS has enough power to act as an OSM tile server. The main idea evolves from the fact that internet is not a safe thing in rural areas. If there is an internet connection, the school server could share it and all XOs would be able to download tiles from servers like the mapnik tile server. But if there is no internet connection, the server could either

  1. has cached all tiles (of interest) or
  2. even calculate its own tiles from a local OSM database.

Both possibilities are quite  interesting.

However, to simplify the work we decided to concentrate on the caching variant. For this we set up a small server script delivering tiles which are already cached on serverside. See on the Hacknight Twiki for some code.

Collaboration

Getting connected with other XOs is important to create a colloborative game. The second group wanted to find out more about the sharing functionality of an ativity. For this, we created a small activity reading out information about other XOs connected to the mesh network.

Nicknames,  Hashcodes and other attributes could be read out. Unfortunately, no exchange of custom data could be established at the Hacknight. Nevertheless, the basic steps and experiences were made we can build on.

GPS/Position Integration

Location is essential and probably the most importatnt thing when communicating and mediating geospatial conciousness. Running the great GPS daemon gpsd (for now we’ve to start it in the terminal, but it wouldn’t be too hard to start it from python, I guess), we extract the gps info via python gps module and keep it up to date every three seconds:

<br />
#!/usr/bin/env python<br />
import os<br />
import gps<br />
import time<br />
import logging</p>
<p>import utils<br />
import constants</p>
<p>LOGGER = logging.getLogger('position-logger')<br />
utils.init_logging(LOGGER)</p>
<p># this prepares for intended start of gpsd from terminal (e.g. gpsd /dev/ttyACM0)<br />
_FILE = open(os.path.join(constants.CONFIG_PATH, 'gpsdevice'))<br />
_DEVICES = [dev.strip() for dev in _FILE.readlines() if not dev.startswith('#')]<br />
if len(_DEVICES) != 1:<br />
    LOGGER.warn('Check your gpsdevices config file.')</p>
<p>try:<br />
    GPS_SESSION = gps.gps()<br />
except:<br />
    GPS_SESSION = None #IGNORE:W0702<br />
    LOGGER.warning('Could not initialize GPS session.')</p>
<p>###################################################<br />
class GPSReceiver():<br />
    """Receives GPS signal from gpsd Daemon.</p>
<p>    TODO There is a dbus alternative. . .<br />
    """<br />
    def __init__(self, gps_infos):<br />
        """Creates GPS_SESSION."""<br />
        LOGGER.debug('Create GPSReceiver.')<br />
        self.result = gps_infos</p>
<p>    def get_position(self, query='admosy'):<br />
        """Gathers the current position information."""<br />
        try:<br />
            GPS_SESSION.query(query)<br />
        except:<br />
            LOGGER.error("No GPS connection possible. ")<br />
            raise StopIteration, "No GPS connection possible. "<br />
        if GPS_SESSION:<br />
            self.result['latitude'] = GPS_SESSION.fix.latitude<br />
            self.result['longitude'] = GPS_SESSION.fix.longitude<br />
            self.result['utc'] = GPS_SESSION.fix.time<br />
            self.result['altitude'] = GPS_SESSION.fix.altitude<br />
            self.result['eph'] = GPS_SESSION.fix.eph<br />
            self.result['epv'] = GPS_SESSION.fix.epv<br />
            self.result['speed'] = GPS_SESSION.fix.speed<br />
            self.result['climb'] = GPS_SESSION.fix.climb<br />
            self.result['satellites'] = GPS_SESSION.satellites</p>
<p>            if self.result['latitude'] == 0 and self.result['longitude'] == 0:<br />
                # wait if gps has not been initialized yet.<br />
                LOGGER.debug('wait for connection')<br />
            #LOGGER.debug(self.result)</p>
<p>###################################################</p>
<p>if __name__ == '__main__':</p>
<p>    infos = {'latitude'  : 0.0,  # WGS84 latitude<br />
             'longitude' : 0.0,  # WGS84 longitude<br />
             'utc'       : None, # UTC time<br />
             'altitude'  : 0.0,  # m over sealevel<br />
             'eph'       : 0.0,  #<br />
             'epv'       : 0.0,  #<br />
             'speed'     : 0.0,  # current speed<br />
             'climb'     : 0.0,  #<br />
             'satellites': 0     # #satellites<br />
             }</p>
<p>    recvr = GPSReceiver(infos)</p>
<p>    for i in range(0, 100):<br />
        recvr.get_position()</p>
<p>        print 'latitude    ' , infos['latitude']<br />
        print 'longitude   ' , infos['longitude']<br />
        print 'time utc    ' , infos['utc']<br />
        print 'altitude    ' , infos['altitude']<br />
        print 'eph         ' , infos['eph']<br />
        print 'epv         ' , infos['epv']<br />
        print 'speed       ' , infos['speed']<br />
        print 'climb       ' , infos['climb']<br />
        print infos['satellites']</p>
<p>        time.sleep(3)<br />


First Progress

After playing around with the XO, Sugar and python I have managed to embed html into the application. Have a look at the first raw snapshots:

The user can choose available geomodules. Graphics for each plugin will follow..

The user can choose available geomodules. Graphics for each plugin will follow..


These pictures were captured within the sugar emulator coming with Debian Linux Lenny. I’ll test it on an XO soon, to see, how it performs there.

 

Using openlayers in a gtk.widget as embedded html.

Using openlayers in a gtk.widget as embedded html.


Sure, many functionality is still missing, but this will be a step-by-step process. First the basics, other tools and modules will follow iteratively. I appreciate any comments and ideas. Feel free to comment :).

I know that the XOs don’t necessarily have internet connections in rural areas. This is only a play-around, but most probably will become part of the geospace framework API. Besides that some offline raster georeferencing tools will also become part of the API.