Garcia Programming
Last Modified: 2006-11-21
find:

basket

Acroname Robotics PDF webpage version Garcia Programming PDF

Related
Products

Product image for Garcia Robot
Garcia Robot

Contents

Introduction

The Garcia API offers high-level control of the Garcia robot in a flexible framework.  The framework can readily be extended to include additional functionality around additional sensors or unique circumstances you may place the robot in.  Every attempt has been made to offer this API without any Operating System or development environment bias as these can change and differ between groups using the Garcia Robot. 

Architectural Map

The overall architecture is a host computer that runs the Garcia API and is connected through a data streaming link to the BrainStem network running on the Garcia robot.  The host may be on-board or it may be remote.  There are several layers of software that manage the packets traveling across the link as well as the link status (derived from the heartbeat) and the journaling of communication when requested. 

The lowest layer of the architecture is handled by multiple BrainStem modules that interface directly to the physical hardware and sensors on the Garcia Platform.  These BrainStem modules also typically run TEA virtual machine code to perform behaviors directly on the modules to avoid any latency or bandwidth issues in the link. 

Garcia API Architectural Map.

Garcia API's Goals

There are many, at times competing, goals the Garcia API is aimed at accomplishing.  The overriding goal is to encapsulate as much of the functionality for the programmer so that the he or she can focus on the upper-level algorithm, not the specifics of sensors, motion control, and communication.  Here are many of the other goals:

  • Offer rich, dynamic views of the API as it functions. 
  • Remove the requirement for specific knowledge of BrainStem programming while still allowing it. 
  • Support equally both C++ and Java interfaces. 
  • Make no specific requirements around development tools or environments. 
  • Offer identical interfaces across multiple platforms. 
  • Provide a model for easy expansion and build basic functionality using it. 

Programming Model

Programming Garcia is very straightforward.  The user (programmer) requests one or more primitives from the API and the API takes care of sequencing these behaviors.  As each behavior is completed, the programmer is optionally notified of the completion.  These notifications include a code corresponding to the end-state of the behavior including potential errors.  The operation is entirely asynchronous allowing the programmer to stack up a bunch of behaviors into a sequence list and then perform other computation while the behaviors are being sequenced from the list.  The API is threaded so there is no risk of blocking the sequencing while performing other programming tasks. 

Behaviors are actually all implemented as API plug-ins allowing the programmer to create new, custom atomic behaviors.  These can then be called and handled within the sequencing framework.  When the behavior plug-in is loaded, it can check the state of the Garcia to make sure it is properly configured to accommodate the behavior.  This configuration is typically handled with small TEA programs and reflexes residing on the BrainStem modules the API talks to to control the Garcia robot. 

Small Code Example

Here is a very simple C++ example which is included in the software downloads that shows how a programmer would make the robot move in a small equilateral triangle with sides of 1/2 meter in length. 

#include <sys/time.h> #include <unistd.h> #include <stdio.h> #include "acpGarcia.h" int main(int argc, char* argv[]) { acpGarcia garcia; aBehaviorRef test; printf("waiting for garcia\n"); while (!garcia.isActive()) { printf("still waiting\n"); usleep(100000); } printf("queueing a simple triangle\n"); test = garcia.createBehavior("move", "out"); garcia.setFloatProperty(test, "distance", 0.5f); garcia.queueBehavior(test); test = garcia.createBehavior("pivot", "turn"); garcia.setFloatProperty(test, "angle", (float)(3.1459 * 2 / 3)); garcia.queueBehavior(test); test = garcia.createBehavior("move", "over"); garcia.setFloatProperty(test, "distance", 0.5f); garcia.queueBehavior(test); test = garcia.createBehavior("pivot", "turn"); garcia.setFloatProperty(test, "angle", (float)(3.1459 * 2 / 3)); garcia.queueBehavior(test); test = garcia.createBehavior("move", "back"); garcia.setFloatProperty(test, "distance", 0.5f); garcia.queueBehavior(test); test = garcia.createBehavior("pivot", "turn"); garcia.setFloatProperty(test, "angle", (float)(3.1459 * 2 / 3)); garcia.queueBehavior(test); printf("waiting for triangle completion\n"); while (!garcia.isIdle()) usleep(100); printf("done\n"); } /* main */

API View

When the Garcia API instantiated, it creates threads to manage communication with the Garcia robot.  In addition, this API manages a small http server that allows a programmer or user to view and manipulate basic API functionality.  This can be an invaluable tool for diagnosing, debugging, and learning more about how the API operates.  Since this is served as web pages, this debugging and sniffing can be handled remotely, possibly from a computer other than the host computer. 

Revision History:

  • 2003-03-20: Page Created

Garcia
Resources

 
 
voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy
© Copyright 1994-2010 Acroname, Inc., Boulder, Colorado. All rights reserved.