Tested Distributions
I have tested robos-1.0 and these setup instructions on the following linux distributions:
- Redhat 7.3 and 9.0 (robos-1.0)
- Debian Woody 3.1 (robos-1.0)
- Ubuntu 6.10 (robos-2.0)
Most likely, one of the two versions of robos can work also on other versions of linux. The differences between robos-1.0 and robos-2.0 are relatively minor.
Installing the Cross-Compiler
You don't need to do this for CMPE 117: the cross compiler is already installed.
First, you need to install the H8300 cross-compiler, unless it has already been installed. The Hitachi H8300 is the CPU found in the Lego Mindstorms. Depending on your distribution, proceed as follows:
- Redhat. You need to install the following rpms, in the order in which they are listed:
- Debian Woody. You need to install the following packages:
Debian, Ubuntu: you need to install the following packages:
- binutils-h8300-hms
- gcc-h8300-hms
Installing robos
- Download the source code:
robos-1.0.tar.gz for Debian Woody
robos-2.0.tgz for Ubuntu 6.10 and Debian Sarge distributions.
This does not work yet under Ubuntu 7.04, due to changes in the assembler. I do wish the linux community paid more attention to backwards compatibility ..
Unpack the tarball with tar xfvz robos-1.0.tar.gz or tar xfvz robos-2.0.tgz
cd robos-1.0 or cd robos-2.0
Follow the instructions in the README file.
lnpd
This still has not been tested under Ubuntu 2.10.
lnpd.tgz This is the package for listening to Lego packets from a PC.
Installation Instructions for lnpd
- First, you need to untar the package, with
tar xfvz lnpd.tgz
- Follow the instructions in the README file for compiling. Then, I had to add the following line to my .cshrc file:
setenv LD_LIBRARY_PATH /home/studentxx/lnpd/lnpd+liblnp/liblnp:$LD_LIBRARY_PATH
or to the .bashrc file:export LD_LIBRARY_PATH=/home/studentxx/lnpd/lnpd+liblnp/liblnp:$LD_LIBRARY_PATH
where I assume that /home/studentxx is the path to the directory where you have expanded lnpd.tgz.
To run it, get two windows. On one, do, from the lnpd/lnpd+liblnp/lnpd directory:
./lnpd --nolock --debug --log=/dev/stdout --verbosity=i
- From the other one, go to the lnpd/lnpd+liblnp/applications directory, and do:
./lucatest
This will list on the screen the packets it is receiving. Each packet is listed in two lines: the first line contains the hex dump, and the second line is the packet content.
I tested this code, and I believe it is free of bugs.
Suggestions
You have to shut off both lnpd and lucatest before loading new programs onto the Lego brick, otherwise strange things may happen (the Lego goes into a funny state and stops working).
Also, you need to start a fresh instance of lnpd and lucatest from time to time.
Finally, as you can see from the documentation for lnpd, there may be a way to write all of your code for the PC, and debug it there first, and only later port it to the Lego brick. Once you get lnpd running, the Lego side and the PC side look the same to a running application. A final note Depending on the system, it might be the case that you can run lnpd (the first of the two windows above) only as root. Otherwise, the PC was not receiving any packets, essentially. I don't have this problem on my PCs, but if you have it in the lab, let me know.
Let me know if there are any problems.
License
robos is released under the Mozilla public licence, like legOS-0.2.4 (of which robos is a trivial derivative). For more information, read the LICENSE file distributed with the source code.
