OK, after a lot of time trying to teach myself to write device drivers in QNX, I'm jumping back into the Linux world.
I've stripped the bot down to the aluminium, and am building it back up one part at a time.
Hardware setup - EFIKA running openSUSE10.3 (thanks Matt!), with devantech usbi2c dongle. Connected to the i2c bus is a devantech md23 motor driver with two MEB30 drive motors. I've got eight srf02 sonars waiting in line, as well as a usb camera.
Software setup - one nice thing about this, from a practical point of view, is that it's all user-space. The FTDI FT232R USB chip in the USBI2C has a linux kernel driver, so it's just a serial port interface.
Linux has a pretty nice high-resolution timer interface, new since I've delved very deeply into system-level programming with it. So I've got three threads, with shared memory spaces for inter-thread coms. The executive thread is a command processor, and (of course) spends most of it's time blocked waiting for user i/o. I've currently got a 10Hz process and a 1Hz process. Each process runs a set of FSMs (Finite State Machines). Each FSM is responsible for handling one task or piece of hardware. The FSM-based approach to robotics software is a bit hard to get used to, but is very powerful and expandable - I learned about it while on sabattical at NASA's Jet Propulsion Laboratory (Hi, Hrand!)
The software is a classic three-layer (plus system support) architecture. A device-driver level implements low-level interface algorithms and being largely independent from other modules (e.g. a set of md23 read/write routines). A device-layer level abstracts and utilizes these low-level routines into a FSM architecture that is called repeatedly. For example, one FSM monitors each motor, and utilizes md23 routines to start/stop/change speed for the motors. Finally, an application layer will coordinate these independent FSMs to perform useful work.
Current status
- System support for 10Hz, 1Hz, shm, signal handling, timestruct, and command processing working. Monitoring and alarming of system overload on 1/10Hz command queues.
- DDs working for md23 and srf02
- DL FSM working for MotorControl, written for SonarCtrl
- No APL layer yet (unless you count command processing)