AIBO Tutorial - PowerPoint PPT Presentation

About This Presentation
Title:

AIBO Tutorial

Description:

AIBO Tutorial CS 4631 Spring 2004 Ram Ravichandran – PowerPoint PPT presentation

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

less

Transcript and Presenter's Notes

Title: AIBO Tutorial


1
AIBO Tutorial
  • CS 4631 Spring 2004
  • Ram Ravichandran

2
Outline
  • Introduction
  • Basic OPENR Program Constructs
  • Code Development
  • Executing and Debugging
  • Flow of Development
  • Parting advice

3
Introduction
  • Environment
  • Code developed using C, OPENR API
  • Installed under /usr/OPENR_SDK
  • available from www.jp.aibo.com/openr/
  • Documentation
  • (available under /usr/OPENR_SDK/documentation )
  • AIBO Programming manual
  • ERS-210 Information
  • API Specifications (Level II reference Guide)

4
Introduction
  • Sample Programs
  • Best way to learn writing code
  • All sample programs are available under
    /usr/OPENR_SDK/sample
  • Copy to your home directory and change
    permissions.
  • run using make PREFIX/usr/OPENR_SDK

5
OPENR Objects
  • True OO (very similar to Squeak/SmallTalk)
  • Similar to a UNIX process
  • Communication through message passing.
  • Object waits for message selector,data to
    arrive.
  • Once a message arrives, objects call the method
    based on the selector specified in stub.cfg.
  • Arguments to the method is the data in the
    message
  • Wait for more messages.

6
Inter-object communication
  • Brief overview
  • Subject
  • Object that sends a message
  • Observer
  • Object that receives the message
  • Every observer has a message queue.
  • Subject sends Observer a NotifyEvent.
  • Observer replies with a ReadyEvent
  • ASSERT_READY
  • DEASSERT_READY

7
Core Class
  • Each Object has a Core Class
  • A Sample Core Class
  • include ltOPENR/OObject.hgt
  • include ltOPENR/OSubject.hgt
  • include ltOPENR/OObserver.hgt
  • include "def.h
  • class SampleClass public OObject
  • public
  • SampleClass()
  • virtual SampleClass()
  • OSubject subjectnumOfSubject
  • OObserver observernumOfObserver

8
Core Class (2)
  • Continued
  • virtual OStatus DoInit(const OSystemEvent
    event)
  • virtual OStatus DoStart(const OSystemEvent
    event)
  • virtual OStatus DoStop(const OSystemEvent
    event)
  • virtual OStatus DoDestroy(const OSystemEvent
    event)
  • //Describe the member functions corresponding to
    Notify,
  • //Control, Ready, Connect method.

9
Inter-object Communication
  • Control Method
  • Used by the Subject to receive a connection
    result
  • Connect Method
  • Used by observer to receive a connection result
  • Notify Method
  • Used by Observer to receive a message
  • Ready Method
  • Used by Subject to receive the ASSERT_READY and
    DEASSERT_READY signals from Observer.

10
DoXXXX() Method Macros
  • DoInit
  • NEW_ALL_SUBJECT_AND_OBSERVER
  • Registers the necessary number of Subjects
    Observers.
  • REGISTER_ALL_ENTRY
  • registers the connection to services offered by
    other objects
  • SET_ALL_READY_AND_NOTIFY_ENTRY
  • This registers all entry points.
  • DoStart
  • ENABLE_ALL_SUBJECT
  • Enables all the Subjects
  • ASSERT_READY_TO_ALL_OBSERVER
  • This sends ASSERT_READY to all subjects.

11
DoXXXX() Method Macros (2)
  • DoStop()
  • DISABLE_ALL_SUBJECT
  • This disables all subjects of core class.
  • DEASSERT_READY_TO_ALL_OBSERVER
  • This sends a DEASSERT_READY to all connecting
    subjects.
  • DoDestroy()
  • DELETE_ALL_SUBJECT_AND_OBSERVER
  • This deletes all observer and subjects.

12
More Message Passing
  • Observer first sends all its subjects an
    AssertReady
  • void SampleObserverSendAssertReady()
  • observerobsfunc1-gtAssertReady( )
  • When Subject receives AssertReady, it sends the
    data.
  • void SampleSubjectReady(const OReadyEvent
    event)
  • char str32
  • strcpy(str, Some Text Message)
  • subjectsbjFunc2-gtSetData(str,sizeof(str))
  • subjectsbjFunc2-gtNotifyObservers( )

13
More Message Passing (2)
  • When observer receives the data, it sends an
    ASSERT_READY again
  • void SampleObserverNotify(const ONotifyEvent
    event)
  • const char text (const char)event.Data(0)
  • observersbjFunc1-gtAssertReady()

14
Stub File
  • Used to define member functions that receive
    messages
  • A sample Stub File (stub.cfg)
  • ObjectName SampleClass
  • NumOfOSubject 1
  • NumOfOObserver 2
  • Service SampleClass.Func1.Data1.S,Control(),Re
    ady()
  • Service SampleClass.Func2.Data2.O,Connect(),No
    tify1()
  • Service SampleClass.Func3.Data2.O,Control(),No
    tify2()
  • Extra WakeUpOnLan()
  • Extra UpdateBatteryStatus()

15
Building
  • Make a Directory (lets call it Output) in the
    parent directory of the directory where you have
    the source files. We will put the final output
    executables in this directory.
  • Copy the directory OPEN-R from /usr/OPENR_SDK/MS
    into Output.
  • Copy Makefile-parent from /usr/OPENR_SDK/MS to
    ltParent dirgt/Makefile
  • Copy Makefile-child from /usr/OPENR_SDK/MS to
    ltsrc file dirgt/Makefile
  • Edit both makefiles.
  • type makemake install in the parent directory.

16
Building (2)
  • A picture is worth a thousand words

17
Editing Configuration Files.
  • .ocf file
  • Has one line in it of the following format.
  • object NAME STACK_SIZE HEAP_SIZE SCHED_PRIORITY
    cache tlb user
  • connect.cfg file
  • This file is in ltparent_dirgt/MS/OPEN-R/MW/CONF
  • Dictates who talks to who using what services
    (registered in stub.cfg)
  • Contains lines similar to
  • object1.sendStream.datatype1.S
    object2.recvStream.dataType1.O
  • object.cfg file
  • contains a list of .bin files (objects)
  • add the objects you have compiled
  • do not erase tinyftpd.bin and powermon.bin

18
Executing and Debugging
  • Insert the memory stick in the laptop.
  • At the prompt, type
  • mount /sony
  • Once the memory stick has been mounted, then copy
    the files from /MS/OPEN_R to /sony
  • cp rf ltparent dirgt/MS/OPEN_R /sony
  • un-mount the memory stick.
  • umount /sony
  • Put the memory stick in the dog and press the
    power button on the dog.
  • DEBUGGING
  • For debugging information see chapter 5 in the
    programmers manual. The explanation in the
    chapter is very clear and extensive.

19
Flow of Development
  • Design your objects
  • Decide on the data type for the inter-object
    communication
  • Write the stub.cfg file
  • Write the core class with the necessary member
    functions
  • Write connect.cfg file
  • Write your .ocf file
  • Build
  • Write object.cfg file
  • Execute on AIBO
  • Debug (perhaps)

20
Parting Advice
  • See sample programs
  • Do NOT let the AIBO walk on hard surfaces. This
    will break the joints. Use the robocup field or a
    similar carpet like surface.
  • Do NOT use joint values greater than the ones in
    the manual. The software does not impose a limit
    on the joint angles. Thus you can BREAK the
    joints by putting in arbitrary values.
  • You will PAY for any broken part.
  • This tutorial is available online (by tonight) at
    http//www.cc.gatech.edu/borg/robotsoccer/aibotu
    t.html
  • Programming the dogs for the first time can be
    frustrating. Do not hesitate to use the mailing
    list to ask questions.
Write a Comment
User Comments (0)
About PowerShow.com