Ro-Bot-X and I have decided to get MRL running on a Chumby !
The Chumby is a consumer electronics product made by Chumby Industries, Inc.. It is an embedded computer which provides Internet and LAN access via a Wi-Fi connection.
First step in the process would be to get Java installed on the Chumby.
Chumby has a wiki with a step by step guide to get a JavaVM (Jam) running. Apparently, JamVM is what the Android OS is based on.
There instructions are will get the JavaVM installed and running from the usb mount point (/mnt/usb/bin/jamvm)
Installation Log
2009-06-06
Bubbly:/mnt/storage/myrobotlab-0006 # java -classpath .:myrobotlab.jar:lib/log4j
-1.2.14.jar org.myrobotlab.service.Invoker -service Invoker services
bootclasspath is empty!
Bubbly:/mnt/storage/myrobotlab-0006 #
This has to do with the JamJVM not knowing where the GNU Classpath is - the results probably from an incomplete or incorrectly installation of the JVM..
To confirm this - I would recommend using one of the early tests to see if it returns the same error (hello3.jar)
2009-06-07
Ro-Bot-X - with his superior networking skills got me ssh access to the Chumby !
Unfortunately the JVM which is installed only complains about "bootclasspath is empty!"
Looked at a couple forum entries saying unzipping capability of the jvm is wonky.
Went back to the link
http://wiki.chumby.com/index.php/Java
to try to recompile it - found out zlib is indeed missing...
Tried to download from a chumby reference which was stale - found zlib here -
http://www.zlib.net/
Downloaded - configured - did a make, and it compiled fine - did a "make install" and got
mkdir: can't create directory '/usr/local/lib': Read-only file system
make: [install-libs] Error 1 (ignored)
did this :
cp libz.so /mnt/storage/gcc/usr/lib
suggests
Yargg.. checking for zlib.h... no
configure: error: zlib.h is missing
So the paths are all wonky because the Chumby has SD mount point - that explains some of my problems
Back to ZLib - need it to install
/mnt/storage/gcc/usr/include and /mnt/storage/gcc/usr/lib
Bubbly:/mnt/storage/test/zlib-1.2.5 # make install prefix=/mnt/storage/gcc/usr
cp libz.a /mnt/storage/gcc/usr/lib
cp libz.so.1.2.5 /mnt/storage/gcc/usr/lib
cd /mnt/storage/gcc/usr/lib; chmod u=rw,go=r libz.a
cp zlib.3 /mnt/storage/gcc/usr/share/man/man3
chmod 644 /mnt/storage/gcc/usr/share/man/man3/zlib.3
cp zlib.pc /mnt/storage/gcc/usr/lib/pkgconfig
chmod 644 /mnt/storage/gcc/usr/lib/pkgconfig/zlib.pc
cp zlib.h zconf.h /mnt/storage/gcc/usr/include
chmod 644 /mnt/storage/gcc/usr/include/zlib.h /mnt/storage/gcc/usr/include/zconf.h
that looked better -> trying the JamVM configure again
./configure --build=i386-linux --host=arm-linux --prefix=/usr/arm-linux
make
Zoiks ! - it made a bunch of Makefiles
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/interp/Makefile
config.status: creating src/interp/engine/Makefile
config.status: creating src/arch/Makefile
config.status: creating src/os/Makefile
config.status: creating src/os/linux/Makefile
config.status: creating src/os/darwin/Makefile
config.status: creating src/os/bsd/Makefile
config.status: creating src/os/solaris/Makefile
config.status: creating src/os/solaris/x86/Makefile
config.status: creating src/os/linux/powerpc/Makefile
config.status: creating src/os/linux/arm/Makefile
config.status: creating src/os/linux/i386/Makefile
config.status: creating src/os/linux/x86_64/Makefile
config.status: creating src/os/linux/parisc/Makefile
config.status: creating src/os/linux/mips/Makefile
config.status: creating src/os/darwin/arm/Makefile
config.status: creating src/os/darwin/powerpc/Makefile
config.status: creating src/os/bsd/powerpc/Makefile
config.status: creating src/os/bsd/arm/Makefile
config.status: creating src/os/bsd/i386/Makefile
config.status: creating src/os/bsd/x86_64/Makefile
config.status: creating src/os/bsd/sparc/Makefile
config.status: creating lib/Makefile
config.status: creating lib/java/Makefile
config.status: creating lib/java/lang/Makefile
config.status: creating lib/jamvm/Makefile
config.status: creating lib/jamvm/java/Makefile
config.status: creating lib/jamvm/java/lang/Makefile
config.status: creating lib/java/lang/reflect/Makefile
config.status: creating lib/java/security/Makefile
config.status: creating lib/gnu/Makefile
config.status: creating lib/sun/reflect/annotation/Makefile
config.status: creating lib/sun/reflect/Makefile
config.status: creating lib/sun/Makefile
config.status: creating lib/gnu/classpath/Makefile
config.status: creating src/config.h
config.status: linking src/arch/arm.h to src/arch.h
config.status: executing depfiles commands
Bubbly:/mnt/storage/test/jamvm-1.5.4 # ls
make all
BURNED !
/../src -fno-reorder-blocks -g -O2 -MT interp.lo -MD -MP -MF .deps/interp.Tpo -c interp.c -fPIC -DPIC -o .libs/interp.o
gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
drop back to recommended version and following the instructions (this time with zlib support)
compiling ..........................................
ran - strip src/jamvm
again with the make install prefix=/mnt/storage/gcc/usr
2009-06-07 - 11:27 PST
Woot .. or rather Wo (partial)
Some of this stuff is finally starting to make sense to me - the directory / path structure read-only right stuff is the cause of most of the blocking issues...
I have not run through a completely successful build and install of JamVM & GNU Classes - however, in the future I think it might be good in the long run to do this hand have the "latest" from jam & gnu
In the interim I'm using the binaries downloaded from http://wiki.chumby.com/index.php/Java which are older versions. I downloaded this and uncompressed it into /mnt/storage/jamvmdl
It turns out the java program is just a script file in this case with a bunch of pathing info. I made my own script called "makeitwork" - the contents are as follows
#!/bin/sh
LD_LIBRARY_PATH=/mnt/storage/jamvmdl/lib /mnt/storage/jamvmdl/bin/jamvm -Xbootclasspath:/mnt/storage/jamvmdl/lib/share/jamvm/classes.zip:/mnt/storage/jamvmdl/lib/glibj.zip $@
ok full WOOT !
java -Djava.library.path=./bin org.myrobotlab.service.Invoker -service Invoker services GUIService gui
Bubbly:/mnt/storage/myrobotlab-0006 # /mnt/storage/jamvmdl/makeitwo
rk -cp .:myrobotlab.jar:lib/log4j-1.2.14.jar org.myrobotlab.service
.Invoker -service Invoker services
0.0.0.0
0
service count 1
The Invoker is up and running !
Now now experiments in trying to get the OpenCV/Arduino service up and running
Bubbly:/mnt/storage/myrobotlab-0006 # /mnt/storage/jamvmdl/makeitwork -cp .:myrobotlab.jar:lib/log4j-1.2.14.jar org.myrobotlab.service.Invoker -service Invoker services RemoteAdapter remote
Alright - I started now 2 yes 2 services - Invoker and RemoteAdapter -The RemoteAdapter is a service you can start when you want other instances of MRL to attach (for example one running from your Windows box)
I have another port forwarding request - could you forward port 6767 (this is the port the RemoteAdpater uses) for protocol UDP ? I'm curious if I can attach from my MRL instance here and debug them...
OpenCV
Boom
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
Which I would figure.....
There will be 2 hurdles here :
1. getting the LIBRARY_PATH or -Djava.path or makeitwork script working correctly
2. I don't "have" the native libraries for an ARM processor - but hopefully - thanks to the huge interest in Android, Samuel Audet has a set of pre-copiled binaries... going to download them to the Chumby...
Looks like the Chumby ARM processor does NOT have a FPU - according to reference - http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/chumby-hacker-board-question-td6259369.html
Samuel built it with and without FPU support - removing n/a binaries and moving the rest into /myrobotlab-0006/bin
Arggh... more jars are required, yet it appears that this version of jamvm DOES NOT support wild card referencing on the classpath e.g. -cp .:/lib/*.jar
Boom
Bubbly:/mnt/storage/myrobotlab-0006 # /mnt/storage/jamvmdl/makeitwork -cp .:myrobotlab.jar:lib/log4j-1.2.14.jar:lib/javacpp.jar:lib/javacv.jar org.myrobotlab.service.Invok
er -service OpenCV camera
0.0.0.0
0
service count 1
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at org.myrobotlab.framework.Service.getNewInstance(Unknown Source)
at org.myrobotlab.service.Invoker.invokeCMDLine(Unknown Source)
at org.myrobotlab.service.Invoker.main(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: java/util/concurrent/ArrayBlockingQueue
at org.myrobotlab.service.OpenCV.<init>(Unknown Source)
at java.lang.reflect.Constructor.constructNative(Native Method)
...4 more
Caused by: java.lang.ClassNotFoundException: java.util.concurrent.ArrayBlockingQueue not found in java.lang.ClassLoader$1{urls=[file:/mnt/storage/myrobotlab-0006/./,file:/mnt/storage/myrobotlab-0006/myrobotlab.jar,file:/mnt/storage/myrobotlab-0006/lib/log4j-1.2.14.jar,file:/mnt/storage/myrobotlab-0006/lib/javacpp.jar,file:/mnt/storage/myrobotlab-0006/lib/javacv.jar], parent=null}
at java.net.URLClassLoader.findClass(URLClassLoader.java:992)
at java.lang.ClassLoader.loadClass(ClassLoader.java:342)
at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at org.myrobotlab.service.OpenCV.<init>(Unknown Source)
...5 more
I think I can fix this one.......
Woot(ish)
Bubbly:/mnt/storage/myrobotlab-0006 # /mnt/storage/jamvmdl/makeitwork -cp .:myrobotlab.jar:lib/log4j-1.2.14.jar:lib/javacpp.jar:lib/javacv.jar org.myrobotlab.service.Invok
er -service OpenCV camera
0.0.0.0
0
service count 1
Service stays up - but non of the JNA JCPP functions have been called - should try these, even though I know there is no /dev/video at the moment ...
Why I do believe there is some EVIL CACHING GOING ON ! trying to get a file to update somehow wget, google code, or some proxy appears to be caching old files -- OR AM I GOING CRAZY !
Yes .. someone was caching now I get ...
Boom
Bubbly:/mnt/storage/myrobotlab-0006 # /mnt/storage/jamvmdl/makeitwork -cp .:myrobotlab.jar:lib/log4j-1.2.14.jar:lib/javacpp.jar:lib/javacv.jar org.myrobotlab.service.OpenC
V
2 [main] ERROR class org.myrobotlab.framework.Service - could not find host, host is null or empty !
384 [main] INFO class org.myrobotlab.framework.Service - os.name [Linux]
393 [main] INFO class org.myrobotlab.framework.Service - os.version [2.6.28-chumby]
398 [main] INFO class org.myrobotlab.framework.Service - os.arch [arm]
402 [main] INFO class org.myrobotlab.framework.Service - java.class.path [.:myrobotlab.jar:lib/log4j-1.2.14.jar:lib/javacpp.jar:lib/javacv.jar]
405 [main] INFO class org.myrobotlab.framework.Service - java.library.path [/mnt/storage/jamvmdl/lib:/mnt/storage/myrobotlab-0006/bin]
407 [main] INFO class org.myrobotlab.framework.Service - user.dir [/mnt/storage/myrobotlab-0006]
413 [main] WARN class org.myrobotlab.framework.ConfigurationManager - file localhost.properties not found
418 [main] WARN class org.myrobotlab.framework.ConfigurationManager - file localhost.opencv.properties not found
482 [main] INFO class org.myrobotlab.comm.CommunicationManager2 - instanciating a org.myrobotlab.comm.CommObjectStreamOverUDP
550 [main] DEBUG class org.myrobotlab.framework.Service - opencv registerServices
13354 [opencv_outbox] DEBUG org.myrobotlab.framework.Outbox - outbox run WAITING
13359 [opencv] DEBUG org.myrobotlab.framework.Inbox - inbox getMsg just before synchronized
13365 [opencv] DEBUG org.myrobotlab.framework.Inbox - Inbox WAITING opencv
13450 [main] INFO org.myrobotlab.service.OpenCV - starting capture
13675 [main] INFO org.myrobotlab.service.OpenCV - starting capture
Exception in thread "OpenCV_videoProcessor" java.lang.UnsatisfiedLinkError: getDeclaredAnnotations
Arrggh ...
First The Bad
Trying to get OpenCV service started gives me
14547 [main] INFO org.myrobotlab.service.OpenCV - starting capture
Exception in thread "OpenCV_videoProcessor" java.lang.UnsatisfiedLinkError: getDeclaredAnnotations
at java.lang.VMClass.getDeclaredAnnotations(Native Method)
I don't know why this would be blowing up here - and I'm pretty sure it's not my code ... so that can make it difficult. It might be the guy who wrote the the Java interface to OpenCV (called JavaCV) ... I've submitted a issue on his project http://code.google.com/p/javacv/issues/detail?id=74 ... He's a really sharp guy (a Fellow Canadian living in Japan) ... I think he has his interface running on Android - which is my next target too
Possibly with the latest release we would not have this issue. I attempted to compile JamVM 1.5.4 (no dice) fell back now to 1.5.3 - looking on details of installing now.....
The Ugly
I mentioned I made the makeitwork script which is a bit kludgy, so are the directory paths to the JamVM and classpath... So is the fact we aren't using the "latest" releases
The Good
The Invoker and RemoteAdapter Services came up and stayed ... Which is great !
This means possibly that you will be able to attach to it from your windows box.
You might start thinking at this point what you want your robot to do?
It would be nice to get port 6767 forwarded to the Chumby too - that way I could connect an instance from here (Portland) and it would allow me to test and debug some of the issues.
Since we are at a point of refactoring, you also might want to think what parts you want on you ChumbyBot - for example you mentioned a larger USB thumbdrive - now would be the time to upgrade those parts...
References
Classpath
I probably messed up the classpath part of the instalation, I am trying to re-install it. Oh well, I'm a noob at linux, easy to mess things up. I'll let you know if it all comes true in the end.
Woot - I connected
This is one instance of MRL running on a PC in Portland, OR connected to another instance running on a Chumby in Toronto !
Shweet ! - So "theoretically - this should give me the ability to start services such as Speech on the Chumby"
Arduino on Chumby
For the Arduino Service its necessary to use rxtxSerial with Java
For the Chumby a librxtxSerial is needed....
Possible list of binaries are http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/
Possible uses for Chumby as a robot brain
I have been trying to make a smaller version of an old butler robot, see my MiniEric robot. I got stuck at mapping and also at vision (color blob recognition by AVRcam). So I was thinking to use Chumby instead of a laptop running Linux to do all the stuff a microcontroller is not able to do. Here is the list of the processes I think will run on the Chumby:
- Vision - color blob, face, objects, etc.
- Speech - TTS or wave files
- Voice recognition (if possible)
- Mapping - keep track of the position in the environment, plot a course to get to a specific point
- Communication (serial) with lower level modules through a Master module (Arduino compatible)
The lower level modules will be connected to the Master module through I2C. There will be at least 2 modules: a Servo module and a Motor module. Perhaps it will be easier if instead of the master module we tap into Chumby's I2C interface.
2009-06-08
Trying to get serial communication working on Java on Chumby. This means native libraries - specifically rxtx serial library from http://rxtx.qbang.org/wiki/index.php/Download
Downloaded the source as the binaries in the ToyBox did not work.
Downloaded this guy
http://rxtx.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip
unzipped - and ran configure
got an error from Jikes and the configure script saying to set CLASSPATH
set the classpath to the old JVM and classes (0.91)
Then got a warning
GNU Classpath classpath-0.97.2
downloaded classpath-0.97.2 to /mnt/usb-E0FD-1813/classpath
following http://wiki.chumby.com/index.php/Java
using :
./configure --build=i386-linux --host=arm-linux --prefix=/usr/arm-linux --with-jikes --disable-gtk-peer --disable-alsa --without-x --with-jni
Boom
Boom
did not find pkg-config in the Chumby sources here - http://files.chumby.com/source/
Made an account and posted request here in the ChumbySphere http://forum.chumby.com/viewtopic.php?id=6727
Just found Chumby SandBox - http://wiki.chumby.com/index.php/Scratchbox might be promising...
ARRRGGGH !
Caught between a
ROCK
Sun's embedded Java works great - but rxtxSerial needs javac - which IS NOT PACKAGED WITH SUN'S BINARIES !
AND A HARDPLACE
The open source JamVM 1.5.4 (latest version) needs over 40 Megs of memory to compile ARRGH
compiled JamVM 1.5.3 (has enough memory)
Wow ...
This has been a huge learning experience...
I have started a new "clean" post... some of the things list what you should not do. Sometimes that's more useful.
The node is currently on the front page here - http://myrobotlab.org/node/96
I do not believe I have ever used a tool chain and cross compiled, I was avoiding it at all costs, but fortunately the Chumby wiki had an easy to step through installation page (link is on the new post).
I installed a number of toolchains and crosstools, crosstools-ng ect ... all with varying results..
At this point I have compiled AND TESTED my first cross compiled c program on the Chumby .. (Build on my Linux x86 and run on the Chumby) IT WORKED ! Yay - hopefully it will work for the bigger programs .. specifically rxtxSerial & OpenCV & GNU Classpath
One step closer
Here I'm connecting to the Arduino Service running on Chumby - So I've made progress.. I've cross-compiled the librxtxSerial.so. Previously, this service would not even start. Now it's started but there is still an error. The "port" selector is blank... So I'll have to tackle this next....
These are where values and parameters can be controlled manually on the Arduino, of course they can be controlled by other Services too. For example a Motor service just attaches to the Arduino. Once its attached on a set of pins then other Services can control the Motor without having to know about any of the Arduino details. (Like Bocks ! )
Green tabs are remote (to me) - the arduino tab is green when its not selected. Alright, progress, but back to the bit twiddling ...
Cross Compiler Environment
Can't get by the configure of JamVM
configure error: zlib is missing
although I build and installed it within the cross compiler environment
it installed into /usr/arm-linux
but the cross compiler appears to be getting the bulk of its material from /usr/arm-linux/arm-none-linux-gnueabi
cp /usr/arm-linux/include /usr/arm-linux/arm-none-linux-gnueabi/include/c++/4.3.2
cp /usr/arm-linux/lib/*.a *.so /usr/arm-linux/arm-none-linux-gnueabi/libc/lib (YIKES)
Got past the lib missing - but got
OpenCV cross compile build
Notes:
went through cmake gui build - filled out cross compile flags (will upload CMake files)
had to move /usr/include to /usr/include_gcc and
link /usr/include ---> /usr/arm-linux/include (Yikes)
several times got frustrated with get_time_day not linking - seems there was no -lrt "realtime" lib reference ... AND THIS all came about because I had "linux" instead of "Linux" as platform !!!!! (YARG)
Problems with jpeglib - no .h found .. tried downloading source <reference> compiled and installed but no library was built (yarg) ... just took suport out of the cmake file...
BUILDING BUILDING BUILDING .. and then undefined reference to `cv::SIFT::SIFT(double, bool, bool, int, int, int, int)'
Remember to remove Android jars
Just so there is not (more) confusion regarding which jni interface libraries to use.
ARM JNI builds
The following commands were used to build the jniopencv_* shared objects in an arm-2008q3 environment
g++ -I/home/gperry/chumby/OpenCV-2.2.0/modules/imgproc/include/ -I/home/gperry/chumby/OpenCV-2.2.0/modules/calib3d/include/ -I/home/gperry/chumby/OpenCV-2.2.0/modules/features2d/include/ -I/home/gperry/javacv/javacv/src/com/googlecode/javacv/cpp/ -I/usr/arm-linux/arm-none-linux-gnueabi/include/c++/4.3.2/ -I/home/gperry/chumby/OpenCV-2.2.0/modules/core/include -I/home/gperry/chumby/OpenCV-2.2.0/modules/flann/include -I/home/gperry/chumby/OpenCV-2.2.0/modules/video/include -I/home/gperry/javacv-read-only/javacv/src/com/googlecode/javacv/cpp -I/home/gperry/chumby/OpenCV-2.2.0/modules/video/include -I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include -I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux jniopencv_video.cpp -Wall -O3 -fPIC -shared -s -o libjniopencv_video.so -L/home/gperry/chumby/opencv.build/lib -lopencv_video