| Garcia aRobot Coding Example |
Last Modified: 2006-12-07
This tutorial discusses a C++ program running on a host computer that uses the aRobot API to manage the Garcia robot. This example also demonstrates two other common issues with the Garcia. First, it shows how to write code that is separate from the main brainstem source tree. Second, it shows how to perform "open-loop" control of the Garcia where you issue commands for motor speeds and request sensor data directly and you are in charge of all the parameters of these. The other possible mode is to use the built in primitives to achieve your goals. Both work well, it just depends on your needs.
How do I get the Garcia robot to allow me to directly control the motors, sensors, etc? Also, how do I do this without changing the files in the Acroname cdev download?
The Garcia robot has many built in functions that are meant to handle most basic navigation tasks. Often, people have some other mechanism, like an AI engine or wrapping API that needs to manages the motors and sensor data directly. This we call open-loop control with respect to the Garcia as it becomes the responsibility of the host code to "close the loop" to provide the appropriate actions to inputs encountered.
We will actually still use on built in primitive for this example called the NULL primitive. This does little more than tell the Garcia's monitor program (in TEA on the robot) to manages possible error conditions like forward obstructions, etc. While this NULL primitive is running, we then can query the sensors and drive the motors with abandon. Only when an error condition is met, will the NULL primitive complete and our example will end.
The aRobot API
This example uses the aRobot API which superceeds the aGarcia API. Internally, they are somewhat different in implementation but they both support the same basic properties and primitives so changing to the aRobot API is typically as easy as changing the constructor call. The aRobot API is quite flexible and can be used for virtually any robot using BrainStem controllers. Even just a raw BrainStem controller can be wrapped in the aRobot API for easier manipulation of I/O.
The basic flow requires building a single instance of the aRobot object from an aRobot API file (.robot file). This object then has properties and primitives that can be manipulated to interact with the robot.
There are only 4 files included in the provided source code combined into a tar ball. This includes a readme.txt and a makefile for Unix. There is a simple application C++ class that manages the demo with several methods for simple tasks like timed delays and changing motor speeds. The code is pretty simple and documented throughout. The readme.txt also contains some tips on getting things running.
| voice: 720-564-0373, email: firstname.lastname@example.org, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy |
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved.