at Carnegie Mellon University
Writing Your First Behavior
This document will walk you through the creation of your first Behavior. Behaviors are high level programs which direct the robot to complete some task, comparable to an application on a PC. Following this guide will give you a behavior which will light up LEDs corresponding to which button is pressed.
The Generic Behavior
Set up the usual C++ boilerplate, inheriting from the BehaviorBase class. This class defines the interface which all Behaviors must follow, and provides some simple housekeeping code.
If this looks scary to you, look over the C++ review.
These functions define the BehaviorBase interface. You will see -*-c++-*- comments at the top of many of our header files - this is a flag to the Emacs editor that it should use C++ mode instead of C mode for syntax hilighting and formatting. You can ignore it.
At this point, you have a valid behavior. All that remains is to add a call to it from the framework so you can activate it. The easy way to do that is to edit project/UserBehaviors.h. You will need to add two lines, one to #include your header file, and another to add a menu item.
// Part 1: add #include statements for your behaviors' .h files here:
// [...] // Part 2: add MENUITEM entries for your behaviors here:
This file is #included by project/StartupBehavior_SetupModeSwitch.cc, which lists all of "Mode Switch" menu entries. You could instead put your behavior in that file, following the example of the demo behaviors already listed there.
Assuming you have already configured Environment.conf, now just go to the root Tekkotsu directory and type make.
Writing Behaviors I: Generic Structure
II: Adding Functionality
Technical NotesArchitectural Overview
Execution and Configuration