Player/Stage Compile on RaspberryPi

It’s easier to just compile the code on the raspberry pi, it’s a bit slow but not a real problem. This is a quick follow up post.

Configuration of cmake

First a CMakeLists.txt file should be made in the main project directory. For example I used the following file from the documentation and changed it a bit.

Now copy the complete project DIR to the Raspberry Pi and then create a build directory. In the build directory run the following command:

The last value is the location of your PlayerStage Project. We only need to run this command once for the project, if we change our main.cpp we don’t need to run this command. Next we can run make to create our program.

Result of the compiled program

The main advantage is that you can fully develop using Stage on your main computer and then export your source to the Raspberry Pi and run in there. One thing I don’t know if its possible to just run the player server and client at the same time. This means that you configure the player server for a specific robot and link it with the client file.

By changing the following line PlayerClient robot(“192.168.0.184″); I’m able to test out the player client on my Raspberry Pi and connect it with the player server running on my laptop.

Player running on the Pi, Stage on my Laptop

So I’ve successfully installed Player on the Raspberry Pi. Now it’s waiting for the robot too arrive.

Installing Player (Player/Stage) on Raspberry Pi

A little heads up on how to install Player/Stage (but only Player) on the Raspberry Pi. First a complete updated system is required.

Installing Player (Player/Stage)

Player depends on the following packages that need to be installed using:

This will take very long, apparently all the packages are found (crazy). I don’t really know if I included too many dependencies (I’m not really sure about the opencv) but it wont hurt! First time I had a file corruption problem (selected wrong package), now everything seems ok. After updating all the packages, restart the Raspberry Pi!

Download the trunk of player from the Player/Stage svn:

Decompress and expand the tarball, we also rename the output folder:

Create a build folder

Great now its time to configure, we use the default configuration. Note that this can easily take 5-15min! Normally there shouldn’t be any errors (maybe some warnings):

Next we compile and install. Also note that the first commando can take around 1h-2h. It’s possible that you see a couple of warnings, nothing to worry about.

Finally we test the installation using the Player help file. The following command should show the Player version number.

And we get the following result:

Running player -h gives the following output

ArduinoPi v1.6 and Release of ArduinoPi Python

Today a new release of ArduinoPi and the first release of the Python version. Lets start with the ArduinoPi v1.6.

ArduinoPi v1.6

Not much has changed, no new features, but if anyone has a request feel free to ask! To start, it’s now only possible to request an analog port using the right number. Using “A0″ will not work, instead use 0. A small change.

I’ve also remove the writeable option in the switch statement. It’s a shame you can’t check if a serial port is writeable or not (only readable) I implemented this myself in the core libs but forgot to remove it, mea culpa.

ArduinoPi Python release

The last few months I’ve taken lessons on Python using codecademy. So I decided to convert the ArduinoPi PHP class to Python (the mother language of the RaspberryPi). The code is available in another GitHub repo (to make it easier) located here https://github.com/JanStevens/ArduinoPi-Python

This is my first real Python project so if there are any no-goes Python wise please say so in the comments. The functionality is rather limited, it’s possible to send digital, pwm, analog, multiple-pwm and multiple-digital commands to the Arduino.

Later on I’ll include more options in the python interface. Before using the ArduinoPi Python make sure you installed pip (sudo apt-get install python-pip).

After that you must install Flask and PySerial using the pip command as follows:

Now you can just run the main.py script using python main.py. I didn’t include an html example yet but you can go in your browser and type the IP address of your PI followed by port number 5000 and then use the commands from API documentation post.

The commands work the same as the PHP version, the only difference is the port number. All the responses are in JSON so you can use AJAX to make a call to a specific URL with POST or GET and get the desired result.

Stay tuned for more updates and more features!