Archive

Code

YARP is another robot development platform, similar to ROS. I had to code up a simple data reader in Python (operating over YARP ports) and couldn’t find any good examples. After some experimenting, I found a solution that worked for me. The following is a simple code snippet for other YARP Python newbies:

class ExampleReader:
    def __init__(self):
        #create a new input port and open it
        self.in_port = yarp.BufferedPortBottle()
        self.in_port.open("/example/data:i")

        #connect up the output port to our input port
        yarp.Network.connect("/example/data:o", "/example/data:i")

        return

    def getData(self):
        #in this example, I assume the data is a single integer
        #we use read() where the parameter determines if it is 
        #blocking (True) or not.

        btl = self.in_port.read(True)

        my_data = btl.get(0).asInt()

        #if you have doubles, you can use asDouble()
        #or strings can be obtained using asString() 

        return my_data

After a couple of weeks of putting it off, I’m releasing an alpha version of the Online Temporal Learning (OTL) C++ library, which can be used for learning time-series in an online environment (samples are processed one at a time). The Online Echo State Gaussian Process (OESGP) and Spatial-Temporal Online Recursive Kernel Gaussian Process (STORK-GP) algorithms are part of this library.

Find the code at bitbuckethttps://bitbucket.org/haroldsoh/otl

And be sure to check out the Getting Started Guides on the wiki.

Comments/Criticisms/Bug reports are welcome! Though, depending on my workload, replies may be slow in coming. Have fun!

P.S.: If you’re looking for the OESGP Experimental setup scripts, you can find them here.

I have about 22 repositories on bitbucket and downloading them can be a pain. Here’s a short script to make life easier:

#!/bin/bash
#Script to get all repositories under a user from bitbucket
#Usage: getAllRepos.sh [username]

curl -u ${1}  https://api.bitbucket.org/1.0/users/${1} > repoinfo
for repo_name in `grep \"name\" repoinfo | cut -f4 -d\"`
do
	hg clone ssh://hg@bitbucket.org/${1}/$repo_name
done

UPDATE: Corrected a typo. Many thanks to fr3d3r1cbaz1n for pointing it out! Also, as fr3d3r1cbaz1n noted, this script only works for Mercurial but git users can easily change the hg command to git.

Follow

Get every new post delivered to your Inbox.