CURRENT ISSUE Contests

bottom corner

Feature Article





Issue #212 March 2008

Robotics with Ada95
by Daniel Ramirez

Start | Why Use Ada95 For Robotics? | GNAT Ada95 Tools | Debugging Ada95 Applications | Ada95 Coding Style |Wireless Sensor Controller | Wireless Messages | The Glove In Action | XYZ Accelerometers | XBee-PRO Wireless UART | Controller Range | USB 2.0 Interface | Ethernet | The Kernel | Ada95 vs. Other Languages | Future Applications | Sources & PDF

WHY USE Ada95 FOR ROBOTICS?

Designing a robust, fault-tolerant robot requires detailed up-front design work, including modeling, simulation, integration, and testing. This is true of NASA’s robots, including the robot arm and interplanetary spacecraft, such as Viking, Explorer, Galileo, and more, which bring us fantastic photos. The Mars exploration rovers, Spirit and Opportunity, provided scientists with evidence of water on Mars. In fact, the International Space Station’s robot arm software was written in Ada. The electronic equivalent of an Ada package is the IC. Each IC has specific inputs, outputs, and more.

Features that make Ada95 ideal for robotics include object-oriented methodology, Ada95 packages, type checking, range checking, representation clauses, generic functions, protected records, tasking, deterministic scheduling, and exception handling. Although Java and C++ have similar features, Ada95 enforces type checking, constraint checking, and exceptions. It also has tasking built into the language so it doesn’t have to make external system calls or POSIX function calls to schedule threads (similar to tasks).

Ada tasks make developing robotic applications—such as collecting sensor data, checking for objects (obstacle detection), and generating motor commands—easier than using a finite state machine (FSM) or a linear control loop. For example, a sensor collection task and motor control task may run in parallel, with a sensor collection task reading the latest motor positions (encoder counts), while the motor control task sends new PWM motor commands to the motors. Your navigation task determines the next move. Using serial (linear) programming would require a finite state machine (FSM).

Ada’s deterministic scheduler makes it easy to schedule tasks and assign them priorities. Passing data between tasks is as easy as a procedure or function call. Simply use accept and select constructs with Ada tasks. Using Ada tasks can make it easier for you to integrate and test the software drivers because it maps well with hardware.

Ada95 protected records provide an easy way for tasks to share data without the need for semaphores and Ada95 tagged types to provide object-oriented functionality similar to C++ and Java. Now you can map Ada tasks and packages to robotic hardware, so adding new hardware and software drivers does not require a complete redesign of your current system. In addition, you also get most of the C/C++ features, including inheritance, function overloading, classes, C++ templates, and tasks.

The key to using Ada95 as a new robot language is to take advantage of its ability to use Win32 libraries via Ada95 bindings and to use its interface to other languages (including C and C++) via the pragma interface function. Now hardware drivers written in C or assembly can be called from Ada95 applications and give them the ability to transmit and receive data via the serial port (COM3 or COM4), via Ethernet TCP/IP, or via the USB interface (USB-HID) bindings. You need these capabilities so you can use your laptop’s serial, USB, or Ethernet ports to communicate with your embedded robot applications.

Previous | Next

 


bottom corner