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

Web based SSH access for your Raspberry Pi using tty.js

Today I’ll talk about web-based SSH access for your Raspberry Pi using node.js and a little app called tty.js. The idea is to open an SSH session in your web browser. This can be useful when you don’t have putty installed or your school blocks every port.

Installing node.js for tty.js

First we need to install node.js, luckily this now has been ported to ARM and can be installed using apt-get. First what is node.js? Node.js is a software system designed for writing highly scalable Internet applications. It’s written in an extend version of JavaScript using event-driven, asynchronous I/O and to minimize overhead and maximize scalability.

Sending notifications from a web server to the client is problematic. For example, in Gmail you get a notifications when a new email arrived. Traditionally this would require a lot of work to set up web sockets to push the notification. Using node.js this is quite easily.

I’m totally not experienced with node.js, but I’m planning on learning the language. I think it can be really useful, for example porting my ArduinoPi to node.js would be awesome cool! (Instant feed back for example).

So installing node.js, just run apt-get install nodejs npm. This can take some time, the installation will go on (I had a awfull lot of errors, but they didn’t seem relevant at all).

Using the package manager for tty.js

Node.js also has a package manager called npm. You can install packages using npm install tty.js for example. Then I failed on understanding how node.js works. I couldn’t find the location or how to start the application. Ho the tty.js GitHub page.

In your home directory there is a new folder called node_modules and in there a folder tty.js. Not that hard after all. To start the application you first go to the folder containing the file tty.js:

The first line will go to the directory and then we start tty.js using the node command. When you now visit your Raspberry Pi IP address and add port 8080 you get the following result, a web-based ssh client.

tty.js a web based ssh client

Configuring tty.js

I found a way to edit the html, so you can change the title and other parts. Everything is located in the tty.js folder in node_modules. The static folder has the CSS and HTML. You can edit some configuration options apparently but I couldn’t find explanation on what they do. The configuration can be found at ~/.tty.js/config.json check the GitHub page for more information.

A little note, people now have full access to your device, I only use my PI in my home network but remember that people have root access. They don’t need to login when they open the URL in their web browser.