OSS in Amateur Robotics Mark Gross [email_address]
OSCON-07 talk based on my on-going SRS robot Magellan development experience
SRS Robot Magellan contest
Autonomous navigation to orange traffic cones in an urban park setting.
grass, potholes, sidewalks curbs, trees…
1000’ approximate distance between farthest cone and start.
robot < 50 pounds, fits in a 4’x4’x4’ cube.
robot has fail save pause / stop mechanism.
See http://www.robothon.org/robothon/robo-magellan.php for rules
My robot’s components
16f877 PIC micro controller base SBC.
Linksys NSLU2 : IXP420 computer.
servos, motor controller, encoder, ultrasonic range finders, digital compass, bump sensor, safety switch, USB camera, USB hub, USB serial dongle, USB memory stick.
built on a radio shack RC toy truck
Architecture
Dual SBC design
PIC for low level device interface
NSLU2 running Linux doing the high level control and vision processing.
Architecture cont.
The PIC talks to all the devices except the USB.
motor controller, motor encoder, ultrasonic range finders, compass, servos, bump and safety switches.
PIC implements RT control loop processing for speed, steering etc.
PIC implements a command response protocol such that the NSLU2 can issue high level command and poll for completion over the serial port
get status, track_heading, forward_turn, reverse_turn
Architecture cont.
NSLU2 running a hacked version of Slugos from the Open Embedded distribution.
Includes spca5xxx camera driver
Python, python serial, python image library and pyv4l
Runs my magellan.py python program from a init script in rc3.d
It’s all a Work in progress.
PDXBot 2007 results : “Flash” took second place*
Robot was barley ready in time and ran with some know problems.
Details on robot its evolution, implementation patches and code are available at : www.thegnar.org
Web site will be updated as I get ready for the Seattle robot event.
There is a lot more to do
*out of 2 entrants ;)
Back to OSS in amateur robotics
PIC was programmed using JALv2, a BSD licensed compiler with a Pascal like syntax and a mixture of BSD and GPL libraries.
GPL and LGPL in PIC library code is problematic for production use of such compiled code. I will not say more about this as that will be a non-amateur application.
NSLU2 ran the SlugOs-image from Open Embedded.
The high level logic of the robot was programmed in Python.
The rest of this presentation drills down on JAL, Open embedded and python use for the application.
JAL (smells like Pascal)
Language created by Wouter van Ooijen
http://www.voti.nl/jal/index_1.html
in 2003 was release as GPL and a source forge community project was started.
JALv2 written by Kyle York, is a technically better compiler
having 2 and 4 byte integers make is very compelling.
I have used both versions and like them both, but if you want multi-byte math JALv2 is the only way to go.
The JALv2 compiler author is resistant to starting a SF or other community project site.
Some Simple JAL code
procedure ping is
var byte temp
_I2C_HW_startbit
-- all sensors will respond to a ping request sent to i2c address zero
_I2C_HW_put_byte(0x00)
_I2C_HW_put_byte(0)
-- get distance in cm.... (need to wait about 2ms/foot!)
_I2C_HW_put_byte(0x51)
_I2C_HW_stopbit
end procedure
JALv0.4.xx
JALv0.4.xx is a GPL compiler with GPL libraries
http:// sourceforge.net/projects/jal /
Installation is the standard ./config, make , make install - build process. builds and runs in Linux, cygwin, mac-osx, and OS/2
Includes a test suite
JALv0.4xx is a better OSS project than Jal V2 with community and SF repository
This version has become stagnate.
JALv2 (by Kyle York)
http://www.casadeyork.com/jalv2/
JALv2 is BSD without library files bundled with the compiler.
JALv2 is a technically better compiler
smaller code
supports multi-byte arithmetic
Compiler is maintained by one guy, the libraries are maintained by others.
No good point for users to contribute fixes to other than Yahoo group mailing list.
bugs in some Library files have gone unfixed at times.
NSLU2 and Open Embedded
http://www.nslu2-linux.org/
is a project of derivative of Open Embedded.
Has a nice makefile base wrapper so you don’t need to understand Bit Bake.
Its got a nice community and good for root file systems that maintain the NAS functions intended for the product.
After using it initially I moved on to just using OE.
http://www.openembedded.org/
its pretty cool.
more suited to hacking than nslu2-linux.org.
Has some usability warts.
Open Embedded
Can be thought of as a bag-O-distributions.
Automates tool chain build, target build and image packaging for many of the existing hackable hardware platforms available today, NSLU2, zarus, n800, x86 pc’s, iPaq’…
Customizable build includes kernel and a wide assortment of components one can choose to include within a build.
has a strong developer community and has good ties to the freedesktop.org, gnome, handles.org, and similar communities.
OE architecture
OE consists of 2 components
Bit Bake
recipe repository
Bit bake is maintained in a SVN repository.
The recipes are maintained in a Monotone repository.
OE developer community
Only a few key folks have check in access to the bit bake and recipe archives.
bugs are identified and logged in the project bugzilla.
patches and bug fixes are submitted via the bugzilla
there is an active and responsive mailing list
there is an active IRC channel.
most OE developers are EU based
Development is quite active, most of the kernels tool chains, and user mode components are current
OE implementation from a high level
Bit bake is the build engine
it is implemented in Python
it parses the configuration and recipe tree recursively to build a dependency cloud.
The seed point for traversing the dependency cloud is determined by the command line argument given to the bit bake command.
Builds are executed under a non-privileged user account.
uses a utility known as fakeroot to build root file systems and device nodes.
Recipes and Monotone
developer boot straps recipe tree using a wget …OE.mnt to bring down a 100MB monotone database.
then a recipe tree is checked out to bring down all the current recipes.
Monotone has some of the CMS flavor of git and mercurial, but is relatively obscure and doesn’t work through proxies well
Monotone also tends to need to be built from source, and depends on boost.
Once the recipes are pulled down you don’t need to use monotone again.
HOWTO’s exist on http://www.openembedded.org/
Hacking OE isn’t trivial
A good UI for target component and dependency browsing or customization is missing from OE.
Sometimes components are available for down load temporarily.
The BitBake has some implicit targets and behaviors that are hard to reverse engineer.
Maintaining customizations across OE updates can is hard.
Has a fair amount of wiki based documentation, but still can be a challenge for the new developer to wrap there heads around.
The oe mailing list is very helpful.
Helping to create better documentation for OE/BitBake is on my to do list
Hacking tips and tricks
bitbake has a number of debug and trace command line options.
nohup bitbake –DDD slugos-image
If doing a new build and it breaks on getting source, try again in a few days. Sometimes archives are not too reliable.
Save your downloads in a up-leveled directory
example: my slugos-image hack
removing slugos NAS related cruft
adding python, python libraries and USB camera driver
0 comments
Post a comment