ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 4177
Скачиваний: 0
Embedded Controllers
Figure 1.5: Braitenberg vehicles searching light (photovore)
Figure 1.5 shows a very similar scenario of Braitenberg vehicles. However, here we have linked the left sensor to the right motor and the right sensor to the left motor. If we conduct the same experiment as before, again the robot will start driving when encountering a light source. But when it gets closer and also slightly off course (veering to the right in the figure), the left sensor will now receive more light and therefore accelerate the right motor. This will result in a left curve, so the robot is brought back on track to find the light source.
Braitenberg vehicles are only a limited abstraction of robots. However, a number of control concepts can easily be demonstrated by using them.
1.2 Embedded Controllers
The centerpiece of all our robot designs is a small and versatile embedded controller that each robot carries on-board. We called it the “EyeCon” (EyeBot controller, Figure 1.6), since its chief specification was to provide an interface for a digital camera in order to drive a mobile robot using on-board image processing [Bräunl 2001].
Figure 1.6: EyeCon, front and with camera attached
7
1 Robots and Controllers
The EyeCon is a small, light, and fully self-contained embedded controller. It combines a 32bit CPU with a number of standard interfaces and drivers for DC motors, servos, several types of sensors, plus of course a digital color camera. Unlike most other controllers, the EyeCon comes with a complete built-in user interface: it comprises a large graphics display for displaying text messages and graphics, as well as four user input buttons. Also, a microphone and a speaker are included. The main characteristics of the EyeCon are:
EyeCon specs
•25MHz 32bit controller (Motorola M68332)
•1MB RAM, extendable to 2MB
•512KB ROM (for system + user programs)
•1 Parallel port
•3 Serial ports (1 at V24, 2 at TTL)
•8 Digital inputs
•8 Digital outputs
•16 Timing processor unit inputs/outputs
•8 Analog inputs
•Single compact PCB
•Interface for color and grayscale camera
•Large graphics LCD (128u64 pixels)
•4 input buttons
•Reset button
•Power switch
•Audio output
•Piezo speaker
•Adapter and volume potentiometer for external speaker
•Microphone for audio input
•Battery level indication
•Connectors for actuators and sensors:
•Digital camera
•2 DC motors with encoders
•12 Servos
•6 Infrared sensors
•6 Free analog inputs
One of the biggest achievements in designing hardware and software for the EyeCon embedded controller was interfacing to a digital camera to allow onboard real-time image processing. We started with grayscale and color Connectix “QuickCam” camera modules for which interface specifications were available. However, this was no longer the case for successor models and it is virtually impossible to interface a camera if the manufacturer does not disclose the protocol. This lead us to develop our own camera module “EyeCam” using low resolution CMOS sensor chips. The current design includes a FIFO hardware buffer to increase the throughput of image data.
A number of simpler robots use only 8bit controllers [Jones, Flynn, Seiger 1999]. However, the major advantage of using a 32bit controller versus an 8bit controller is not just its higher CPU frequency (about 25 times faster) and
8
Embedded Controllers
wider word format (4 times), but the ability to use standard off-the-shelf C and C++ compilers. Compilation makes program execution about 10 times faster than interpretation, so in total this results in a system that is 1,000 times faster. We are using the GNU C/C++ cross-compiler for compiling both the operating system and user application programs under Linux or Windows. This compiler is the industry standard and highly reliable. It is not comparable with any of the C-subset interpreters available.
The EyeCon embedded controller runs our own “RoBIOS” (Robot Basic Input Output System) operating system that resides in the controller’s flashROM. This allows a very simple upgrade of a controller by simply downloading a new system file. It only requires a few seconds and no extra equipment, since both the Motorola background debugger circuitry and the writeable flash-ROM are already integrated into the controller.
RoBIOS combines a small monitor program for loading, storing, and executing programs with a library of user functions that control the operation of all on-board and off-board devices (see Appendix B.5). The library functions include displaying text/graphics on the LCD, reading push-button status, reading sensor data, reading digital images, reading robot position data, driving motors, v-omega (vZ) driving interface, etc. Included also is a thread-based multitasking system with semaphores for synchronization. The RoBIOS operating system is discussed in more detail in Chapter B.
Another important part of the EyeCon’s operating system is the HDT (Hardware Description Table). This is a system table that can be loaded to flash-ROM independent of the RoBIOS version. So it is possible to change the system configuration by changing HDT entries, without touching the RoBIOS operating system. RoBIOS can display the current HDT and allows selection and testing of each system component listed (for example an infrared sensor or a DC motor) by component-specific testing routines.
Figure 1.7 from [InroSoft 2006], the commercial producer of the EyeCon controller, shows hardware schematics. Framed by the address and data buses on the top and the chip-select lines on the bottom are the main system components ROM, RAM, and latches for digital I/O. The LCD module is memory mapped, and therefore looks like a special RAM chip in the schematics. Optional parts like the RAM extension are shaded in this diagram. The digital camera can be interfaced through the parallel port or the optional FIFO buffer. While the Motorola M68332 CPU on the left already provides one serial port, we are using an ST16C552 to add a parallel port and two further serial ports to the EyeCon system. Serial-1 is converted to V24 level (range +12V to –12V) with the help of a MAX232 chip. This allows us to link this serial port directly to any other device, such as a PC, Macintosh, or workstation for program download. The other two serial ports, Serial-2 and Serial-3, stay at TTL level (+5V) for linking other TTL-level communication hardware, such as the wireless module for Serial-2 and the IRDA wireless infrared module for Serial-3.
A number of CPU ports are hardwired to EyeCon system components; all others can be freely assigned to sensors or actuators. By using the HDT, these assignments can be defined in a structured way and are transparent to the user
9
1 Robots and Controllers
© InroSoft, Thomas Bräunl 2006
Figure 1.7: EyeCon schematics
program. The on-board motor controllers and feedback encoders utilize the lower TPU channels plus some pins from the CPU port E, while the speaker uses the highest TPU channel. Twelve TPU channels are provided with matching connectors for servos, i.e. model car/plane motors with pulse width modulation (PWM) control, so they can simply be plugged in and immediately operated. The input keys are linked to CPU port F, while infrared distance sensors (PSDs, position sensitive devices) can be linked to either port E or some of the digital inputs.
An eight-line analog to digital (A/D) converter is directly linked to the CPU. One of its channels is used for the microphone, and one is used for the battery status. The remaining six channels are free and can be used for connecting analog sensors.
1.3 Interfaces
A number of interfaces are available on most embedded systems. These are digital inputs, digital outputs, and analog inputs. Analog outputs are not always required and would also need additional amplifiers to drive any actuators. Instead, DC motors are usually driven by using a digital output line and a pulsing technique called “pulse width modulation” (PWM). See Chapter 3 for
10
Interfaces
video out |
camera connector IR receiver |
|||
serial 1 |
serial 2 |
|||
graphics LCD
reset button power switch
speaker microphone |
input buttons |
parallel port
motors and encoders (2)
background debugger analog inputs
digital I/O
servos (14)
power |
PSD (6) serial 3 |
Figure 1.8: EyeCon controller M5, front and back
details. The Motorola M68332 microcontroller already provides a number of digital I/O lines, grouped together in ports. We are utilizing these CPU ports as
11
1 Robots and Controllers
can be seen in the schematics diagram Figure 1.7, but also provide additional digital I/O pins through latches.
Most important is the M68332’s TPU. This is basically a second CPU integrated on the same chip, but specialized to timing tasks. It simplifies tremendously many time-related functions, like periodic signal generation or pulse counting, which are frequently required for robotics applications.
Figure 1.8 shows the EyeCon board with all its components and interface connections from the front and back. Our design objective was to make the construction of a robot around the EyeCon as simple as possible. Most interface connectors allow direct plug-in of hardware components. No adapters or special cables are required to plug servos, DC motors, or PSD sensors into the EyeCon. Only the HDT software needs to be updated by simply downloading the new configuration from a PC; then each user program can access the new hardware.
The parallel port and the three serial ports are standard ports and can be used to link to a host system, other controllers, or complex sensors/actuators. Serial port 1 operates at V24 level, while the other two serial ports operate at TTL level.
The Motorola background debugger (BDM) is a special feature of the M68332 controller. Additional circuitry is included in the EyeCon, so only a cable is required to activate the BDM from a host PC. The BDM can be used to debug an assembly program using breakpoints, single step, and memory or register display. It can also be used to initialize the flash-ROM if a new chip is inserted or the operating system has been wiped by accident.
Figure 1.9: EyeBox units
12
Operating System
At The University of Western Australia, we are using a stand-alone, boxed version of the EyeCon controller (“EyeBox” Figure 1.9) for lab experiments in the Embedded Systems course. They are used for the first block of lab experiments until we switch to the EyeBot Labcars (Figure 7.5). See Appendix E for a collection of lab experiments.
1.4 Operating System
Embedded systems can have anything between a complex real-time operating system, such as Linux, or just the application program with no operating system, whatsoever. It all depends on the intended application area. For the EyeCon controller, we developed our own operating system RoBIOS (Robot Basic Input Output System), which is a very lean real-time operating system that provides a monitor program as user interface, system functions (including multithreading, semaphores, timers), plus a comprehensive device driver library for all kinds of robotics and embedded systems applications. This includes serial/parallel communication, DC motors, servos, various sensors, graphics/text output, and input buttons. Details are listed in Appendix B.5.
User input/output
RoBIOS |
User program |
|
Monitor program |
||
RoBIOS Operating system + Library functions
HDT
Hardware
Robot mechanics, actuators, and sensors
Figure 1.10: RoBIOS structure
The RoBIOS monitor program starts at power-up and provides a comprehensive control interface to download and run programs, load and store programs in flash-ROM, test system components, and to set a number of system parameters. An additional system component, independent of RoBIOS, is the
13
1 Robots and Controllers
Hardware Description Table (HDT, see Appendix C), which serves as a userconfigurable hardware abstraction layer [Kasper et al. 2000], [Bräunl 2001].
RoBIOS is a software package that resides in the flash-ROM of the controller and acts on the one hand as a basic multithreaded operating system and on the other hand as a large library of user functions and drivers to interface all on-board and off-board devices available for the EyeCon controller. RoBIOS offers a comprehensive user interface which will be displayed on the integrated LCD after start-up. Here the user can download, store, and execute programs, change system settings, and test any connected hardware that has been registered in the HDT (see Table 1.1).
Monitor Program |
System Functions |
Device Drivers |
Flash-ROM management |
Hardware setup |
LCD output |
OS upgrade |
Memory manager |
Key input |
Program download |
Interrupt handling |
Camera control |
Program decompression |
Exception handling |
Image processing |
Program run |
Multithreading |
Latches |
Hardware setup and test |
Semaphores |
A/D converter |
Timers |
RS232, parallel port |
|
Reset resist. variables |
Audio |
|
HDT management |
Servos, motors |
|
Encoders |
||
vZ driving interface |
||
Bumper, infrared, PSD |
||
Compass |
||
TV remote control |
||
Radio communication |
||
Table 1.1: RoBIOS features |
The RoBIOS structure and its relation to system hardware and the user program are shown in Figure 1.10. Hardware access from both the monitor program and the user program is through RoBIOS library functions. Also, the monitor program deals with downloading of application program files, storing/ retrieving programs to/from ROM, etc.
The RoBIOS operating system and the associated HDT both reside in the controller’s flash-ROM, but they come from separate binary files and can be
14
References
downloaded independently. This allows updating of the RoBIOS operating system without having to reconfigure the HDT and vice versa. Together the two binaries occupy the first 128KB of the flash-ROM; the remaining 384KB are used to store up to three user programs with a maximum size of 128KB each (Figure 1.11).
Start |
||
RoBIOS (packed) |
||
112KB |
||
HDT (unpacked) |
||
128KB |
||
1. User program |
||
(packing optional) |
256KB |
|
2. User program |
||
(packing optional) |
384KB |
|
3. User program |
||
(packing optional) |
512KB |
|
Figure 1.11: Flash-ROM layout
Since RoBIOS is continuously being enhanced and new features and drivers are being added, the growing RoBIOS image is stored in compressed form in ROM. User programs may also be compressed with utility srec2bin before downloading. At start-up, a bootstrap loader transfers the compressed RoBIOS from ROM to an uncompressed version in RAM. In a similar way, RoBIOS unpacks each user program when copying from ROM to RAM before execution. User programs and the operating system itself can run faster in RAM than in ROM, because of faster memory access times.
Each operating system comprises machine-independent parts (for example higher-level functions) and machine-dependent parts (for example device drivers for particular hardware components). Care has been taken to keep the machine-dependent part as small as possible, to be able to perform porting to a different hardware in the future at minimal cost.
1.5 References
ASIMOV I. Robot, Doubleday, New York NY, 1950
BRAITENBERG, V. Vehicles – Experiments in Synthetic Psychology, MIT Press, Cambridge MA, 1984
15
1 Robots and Controllers
BRÄUNL, T. Research Relevance of Mobile Robot Competitions, IEEE Robotics and Automation Magazine, Dec. 1999, pp. 32-37 (6)
BRÄUNL, T. Scaling Down Mobile Robots - A Joint Project in Intelligent MiniRobot Research, Invited paper, 5th International Heinz Nixdorf Symposium on Autonomous Minirobots for Research and Edutainment, Univ. of Paderborn, Oct. 2001, pp. 3-10 (8)
INROSOFT, http://inrosoft.com, 2006
JONES, J., FLYNN, A., SEIGER, B. Mobile Robots - From Inspiration to Implementation, 2nd Ed., AK Peters, Wellesley MA, 1999
KASPER, M., SCHMITT, K., JÖRG, K., BRÄUNL, T. The EyeBot Microcontroller with On-Board Vision for Small Autonomous Mobile Robots, Workshop on Edutainment Robots, GMD Sankt Augustin, Sept. 2000,
http://www.gmd.de/publications/report/0129/Text.pdf, pp. 15-16 (2)
16