CMUs Tekkotsu Framework - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

CMUs Tekkotsu Framework

Description:

... signalled, the corresponding transition will deactivate its state by calling the ... The DoStop() will deactivate all other outgoing transitions, and and activate ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 21
Provided by: pagesCpsc4
Category:

less

Transcript and Presenter's Notes

Title: CMUs Tekkotsu Framework


1
CMUs Tekkotsu Framework
CSE398/498-011 28 Jan 05 John Spletzer Lehigh
University
2
Supporting References
  • The Tekkotsu Home Page
  • http//www-2.cs.cmu.edu/tekkotsu/

3
The Programming Hierarchy
  • The Aibos run the Sony Aperios Operating System
  • Sony provides an OPEN-R C SDK to interface with
    the hardware
  • CMU Tekkotsu framework provides a wrapper around
    OPEN-R to abstract away much of the low-level
    programming requirements (controlling joint
    angles and torque, low level vision, etc.)
  • Tekkotsu makes extensive use of inheritance and
    templates for developing new behaviors
  • We will rely upon these when building our own code

Aperios
4
Some of the Major Tekkotsu Modules
  • Vision Processing (including CMVision)
  • Walking routine
  • Head control
  • Hierarchical State Machine
  • Wireless networking
  • PC Monitoring tools

5
Intro to Tekkotsu Architecture
  • Applications are organized as collection of
    Behaviors and MotionCommands

http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/
6
Intro to Tekkotsu Architecture
  • Their member functions run in 2 cooperating
    processes Main and Motion

http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/
7
MainObj
  • Main does the bulk of the processing
  • Does the vision processing and the decision
    making AI
  • Works on a 32 ms time slice (30 fps video stream)
  • Behaviors are instantiated and run in Main
  • This is where we will be writing most of our code

http//www-2.cs.cmu.edu/tekkotsu/Overview.html
8
MotoObj
  • Motion is a real-time process (gets priority)
  • Responsible for motion/control of joint
    effectors, updating values of LEDs
  • Must get priority to ensure smooth motion (why?)

http//www-2.cs.cmu.edu/tekkotsu/Overview.html
9
MotoObj (contd)
  • MotionCommands are instantiated in shared memory
    (blue), and most of the computation is done in
    Motion
  • Certain member function can run in Main
  • MMAccessor provides a mutual exclusion mechanism
    to allow behaviors to update shared memory
    structures while they are being used by
    MotionManager in Main

http//www-2.cs.cmu.edu/tekkotsu/Overview.html
10
Behaviors
  • Behaviors are implemented in ______________
  • Behaviors are classes that inherit from the base
    class BehaviorBase
  • Each behavior has 3 essential member functions
  • DoStart()
  • DoStop()
  • processEvent()
  • processEvent is where the behavior processing is
    done
  • Behaviors are event driven

11
Simple Behavior Implementation
ifndef INCLUDED_JrsBehavior_h_ define
INCLUDED_JrsBehavior_h_ include
"Behaviors/BehaviorBase.h" class JrsBehavior
public BehaviorBase public JrsBehavior()
BehaviorBase("JrsBehavior") virtual void
DoStart() BehaviorBaseDoStart()
stdcout ltlt getName() ltlt " is starting up."
ltlt stdendl virtual void DoStop()
stdcout ltlt getName() ltlt " is shutting down."
ltlt stdendl BehaviorBaseDoStop()
endif
http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/b
ehaviors.shtml
12
An Event-Driven Programming Model
  • Main receives sensor readings and image frames
    from the OS at regular intervals
  • Main processes the information and sends events
    as required
  • No two parts of Main can be executing at the same
    time
  • Only one event is processed at any given time
  • At a lower level, the process is as follows
  • At initialization, behaviors register as
    listeners to a desired event stream (button
    pushed, ball seen, etc.)
  • Where do we think this would happen?
  • This list is maintained by the event router
    erouter
  • Whenever the registered event occurs, the
    registered behavior is activated.
  • How do we think this would happen?

13
What are Events?
  • Objects of course
  • Consist of three parts
  • Generator (e.g. button generator, vision system,
    timer)
  • Source (e.g. which button?
  • Type (EventBaseactivateETID, EventBasedeactiva
    teETID, EventBasestatusETID)
  • These enable the listening behavior to shape its
    actions

14
Simple Behavior with Events
ifndef INCLUDED_JrsBehavior_h_ define
INCLUDED_JrsBehavior_h_ include
"Behaviors/BehaviorBase.h" include
"Events/EventRouter.h" class JrsBehavior
public BehaviorBase public JrsBehavior()
BehaviorBase("JrsBehavior") virtual void
DoStart() BehaviorBaseDoStart()
stdcout ltlt getName() ltlt " is starting up."
ltlt stdendl erouter-gtaddListener(this,EventBas
ebuttonEGID) // subscribe to button events
virtual void DoStop() erouter-gtremoveListe
ner(this) // unsubscribe from all events
stdcout ltlt getName() ltlt " is shutting down."
ltlt stdendl BehaviorBaseDoStop()
virtual void processEvent(const EventBase
event) stdcout ltlt "Jrs got event " ltlt
event.getDescription() ltlt stdendl
endif
http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/e
vents.shtml
15
Behavior Implementationthrough a Finite State
Machine (FSM)
  • Non-trivial behaviors are implemented through
    FSMs
  • Tekkotsu supports this through StateNode and
    EventTrans classes
  • Both are subclasses of BehaviorBase

http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/s
tate.shtml
16
The Process for State Machines Behaviors
  • The state is activated by calling its DoStart()
    function
  • This will call StateNodeDoStart()
  • This will call the corresponding
    EventTransDoStart() functions for all
    transitions leaving the state
  • Each transition sets up 1 or more event
    listeners.
  • If an appropriate event is signalled, the
    corresponding transition will deactivate its
    state by calling the DoStop() function
  • The DoStop() will deactivate all other outgoing
    transitions, and and activate the new state by
    calling its DoStart() function
  • Back up to 2, and so on

17
Sample Behavior Implementation
  • The first step in implementing a behavior as an
    FSM is to define a single StateNode

class JrsBehavior public StateNode
protected StateNode startnode public
JrsBehavior() StateNode("JrsBehavior"),
startnode(NULL)
http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/s
tate.shtml
18
Sample Behavior Implementation (contd)
  • This parent node provides a setup function that
    instantiates all nodes and transitions of the FSM

virtual void setup() StateNodesetup()
stdcout ltlt getName() ltlt " is setting up the
state machine." ltlt stdendl SoundNode
bark_node new SoundNode("bark","barkmed.wav")
SoundNode howl_node new SoundNode("howl","how
l.wav") StateNode wait_node new
StateNode("wait") addNode(bark_node)
addNode(howl_node) addNode(wait_node)
EventTrans btrans new EventTrans(wait_node,E
ventBasebuttonEGID,
RobotInfoHeadFrButOffset,EventBaseactivateETID
) btrans-gtsetSound("ping.wav")
bark_node-gtaddTransition(btrans)
bark_node-gtaddTransition(new TimeOutTrans(howl_n
ode,5000)) howl_node-gtaddTransition(new
CompletionTrans(wait_node)) wait_node-gtaddTrans
ition(new TimeOutTrans(bark_node,15000))
startnode bark_node
What happens to these when this function exits?
http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/s
tate.shtml
19
Sample Behavior Implementation
  • DoStart is what is called to activate the machine
  • In turn, it calls the start nodes DoStart to
    activate the machine

virtual void DoStart() StateNodeDoStart()
stdcout ltlt getName() ltlt " is starting up." ltlt
stdendl startnode-gtDoStart() virtual
void DoStop() stdcout ltlt getName() ltlt " is
shutting down." ltlt stdendl StateNodeDoStop()

http//www-2.cs.cmu.edu/7EJrs/Tekkotsu/Tutorial/s
tate.shtml
20
Robot Safety
  • The Aibos are NOT toys. They are expensive
    instructional and research tools. Please treat
    them as such
  • If you have programmed a behavior that makes the
    Aibo take destructive actions (e.g. striking its
    head on the floor), stop it immediately no
    matter how amusing it might seem at the time.
  • Know where your dog is at all times. If you
    tread on its ankle while stepping backwards, it
    will hurt.
  • Work with the robots at ground level. A sudden
    motion can induce a fall from the workbench.
Write a Comment
User Comments (0)
About PowerShow.com