UserPreferences

Gyro


1. Gyro

Guile + Pyro = Gyro

Scheme Robotics

Gyro is a subproject of Pyro. The goal is to replicate what we have in Python in Scheme.

Guile is an open source implementation of Scheme, and is preinstalled on many GNU/Linux systems. Pyro is available at http://PyroRobotics.org/ .

1.1. Installation

In addition to the latest Player/Stage/Gazebo (see Pyro4Installation for installation instructions), you'll need the following:

  1. guile

  2. guile-devel

  3. Paul Osmialowski's http://king.net.pl/playercontrib/guileplayer/

From Fedore Core 3, as root:

yum install guile guile-devel

To build and install guileplayer:

tar xfz guileplayer-20050422-2.tar.gz
cd guileplayer
make
make install   # as root

To run:

export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
export PLAYERPATH=/usr/local/lib
player /home/pyrobot/plugins/worlds/Stage/everything.cfg &
cd scheme_examples
guile -s blobfinder.scm

Sample code:

(load-from-path "guileplayer.scm")

(define display-blobs (lambda (blobs)
    (cond
        ((not (null? blobs))
            (display (player-blobfinder-blob-id (car blobs)))
            (display ":")
            (display (player-blobfinder-blob-color (car blobs)))
            (display " ")
            (display (player-blobfinder-blob-xy (car blobs)))
            (display " ")
            (display (player-blobfinder-blob-lefttop (car blobs)))
            (display " ")
            (display (player-blobfinder-blob-rightbottom (car blobs)))
            (display " ")
            (display (player-blobfinder-blob-area (car blobs)))
            (display " ")
            (display (player-blobfinder-blob-range (car blobs)))
            (newline)
            (display-blobs (cdr blobs))
        )
    )
))

(define main-loop (lambda (client blobfinder)
    (cond
        ((not (player-client-signalled?))
            (player-client-read-for-sure client)
            (display (player-blobfinder-get-image-size blobfinder)) (newline)
            (display-blobs (player-blobfinder-get-blobs blobfinder))
            (display "====") (newline)
            (main-loop client blobfinder)
        )
        (else
            (display "going to quit...")
            (newline)
        )
    )
))

(define client (player-client-create player-null "localhost" 6665))
(player-client-connect client)
(define blobfinder (player-blobfinder-create client 0))
(player-blobfinder-subscribe blobfinder player-read-access-mode)
(player-client-trap-signal SIGINT)
(player-client-trap-signal SIGTERM)
(main-loop client blobfinder)
(player-blobfinder-unsubscribe blobfinder)
(player-blobfinder-destroy blobfinder)
(player-client-disconnect client)
(player-client-destroy client)
(display "player client disconnected") (newline)

1.2. Pyro Devices

We hope to develop the same kinds of abstractions that we have in Python for Scheme. The main ones we will need:

We will also need a gui+thread class with which to run brains, and maybe an engine container class. Donations welcomed!

1.3. Comments and Questions

Add your own here.