Ro-Bot-X and I are working together even though we are 2500 miles away !
Hey Look... I can see Ro-Bot-X's living room through the eye of the bot he's currently working on ! (Hopefully he won't mind me posting it :) )
It was a challenge and learning experience getting the OpenCV running on the Chumby. It required cross compiling binaries on a Linux X86 PC --to--> ARM 9 with a tool chain.
I'm making two new Services in MRL. A Chumby service which will interface with all of the hardware a Chumby has to offer and simplify/standardize it so other Services can use it. And a ChumbyBot service which will contain the behaviors and personality of the little bot.
His board handles Motors a little differently than the 2 way's I am familiar with, so well figure that out and put it in the Motor service with configuration.
I'm beginning to like the little Chumby. It runs Linux and has support for USB, I2C, Video, Microphone, Stereo Speakers, Wifi, Touch-Screen, FM Radio, even an Accelerometer.. and for just $90 on Amazon or lower on ebay
We are just starting to connect the wires and pipes together, but I think the hardest part was the OpenCV support...
What current works
- Remote communication from 2500 miles away attached to my MRL instance
- OpenCV webcam and remote control of vision filters (facedetection, color isolation, LKOptical tracking, etc)
- Web control through an MRL applet
- Remote GamePad control
- TextToSpeech with sexy Audrey voice
Things to test
- MRL/Sphinx4 Speech recognition
- Audio Recording and PlayBack through MRL
- HTTP getting info on the intertubes - jokes, daily news, shoutbox data etc.
- Fancy Sound generation (Drums, Sax, Guitar etc through MRL & JFugue)
- Play Chess? (Thanks Patrick :D)
Things to develop
- Encapsulate Chumby's hardware in a easy to use Service
- Behaviors and Personality for ChumbyBot
- Augment Motor to handle uBotuino's method of control
We will make sure all the lower level stuff works well (Motors, Servos, Sensors, etc) then I believe Ro-Bot-X was interested in grabbing colored objects around the house (cleaning? dunno)
The frame rate of the camera is pretty lousy, but he said he got it for $5.. To reduce the lag as its shipped 2500 miles you can drop the color.
Here I tried isolating the red square out of his carpet... Unfortunately, he has not mounted the thing on a base or camera on a servo.. but that will come shortly...
RoboScope - monitors IR Sharp sensor with 2500 mile test leads !
I was able to log the data coming from the IR Sensor in the SensorMonitor Service .. Here are a few snapshots. It works as a great diagnostic tool, but the real nice part will be the ability to set "Alerts" where a sensor reaches a certain pre-defined (or even dynamic) level and fires off an event. For example, 50 cm = Stop and look for open area.
The IR Sensor was on a servo. The servo swings back and forth and in turn the range changes. As the range changes I can see the value of the IR sensor coming back as a graph. The dip is the change of range since part of the time, the IR sensor is aimed at a nearby wall. The SensorMonitor can graph (and soon Alert) on multiple sensors at once.
The Detailed Nerdy Part:
The first step in this process is to get Java running on Chumby.
A great wiki is provided here http://wiki.chumby.com/index.php/Java
However, It contains references to older versions of JamVM and GNU Classpath. I do not believe that these versions support all the JNI necessary to communicate successfully to the hardware.
Our objective then becomes install the "latest" JamVM and GNU Classpath
Some other lessons I have learned through this process :
- Sun embedded JVM for Arm (headless) - worked great and it was an incredibly easy install, but it is not open source and THE BIG strike against it - is there was no javac (compiler) which would make the compilation of rxtxSerial difficult !
- OpenJDK - seems like a great project - it was originally just targeting PCs - it is huge and cross compiling it for the Chumby seemed like a exercise in extreme torture (please prove me wrong!)
- Don't compile the wrong versions of JamVM and GNU Classpath - they are different projects, so only certain versions of each are compatible - the target we are going for is JamVM 1.5.3 and GNU Classpath 0.98
- Don't compile install JamVM first ! - this only causes problems in the long run - JamVM will not run without a valid GNU Classpath already in place - yes I burned time with this.
- Don't cross compile - another exercise in torture (please prove me wrong!)
- Use JamVM 1.5.3 - at this time JamVM 1.5.4 is available, however, it will not compile on the Chumby - because it needs 40 megs of memory at least to do it - if your an expert in cross compiling you can get around this. I am not an expert in cross compiling - so I'm sticking to 1.5.3
- Don't attempt to bootstrap or compile GNU Classpath on the Chumby itself
The basic strategy will to get an ARM tool chain installed. This will allow us to compile code which runs on the ARM from a regular PC. Thankfully, the very helpful Chumby wiki has such information in step by step instructions (http://wiki.chumby.com/index.php/GNU_Toolchain)
A very popular way to send serial information through Java uses the RXTXComm.jar from http://rxtx.qbang.org . MyRobotLab's Arduino Service uses this code to talk to Arduinos, and theoretically any microcontroller attached via USB-FTDI or serial port. Since Java must interface directly with the hardware in this situation, it will be necessary to build Native code with the cross compiler toolchain we just installed.
Unfortunately, there is a bug in the configure/build at the moment for rxtxcomm.
./configure --target=arm-linux --host=arm-linux --build=i386-linux
After all that labor I have successfully built a librxtxSerial.so for Chumby - which means Java programs can now use it to communicate over Chumby's serial port or USB-FDTI to a microcontroller. There is also a librxtx - Parallel I2C Raw and RS485 libraries. I have attached them to this node.
OpenCV + JavaCV + JavaCPP + MRL
This was rather "educational", and successful in the end.
First a toolchain was necessary to compile all the parts on a Linux machine running a X86 processor (my home box). Chumby has a convenient download for this here. It's "real" name is arm2008q3.
OpenCV was challenging to compile, in that the cmake build wants to get stuff from /usr/include (not a good idea). I have had mixed feeling regarding cmake... but at this point I am beginning to like the gui manager. After symbolically linking a new /usr/include and taking care of all the other dependencies and compiler specifics, I built it with very few options. No GTK or GSTREAMER as I don't believe those are on the target Chumby.
JavaCV is a great interface and MRL uses it to get to OpenCV. JavaCPP is the method which Samuel Audet uses to access the natively compiled OpenCV. Samuel Audet manages both JavaCV & JavaCPP. Although JavaCV supports a wide range of platforms, it does not support Chumby hardware. With some help from Mr. Audet I compiled the necessary interface binaries. I gave him a copy so that JavaCV will have another platform it can successfully talk too. Isn't open source great?
The OpenCV binaries and JavaCV/JavaCPP are attached to this post as well.