AIBO Tutorial.ppt
《AIBO Tutorial.ppt》由会员分享,可在线阅读,更多相关《AIBO Tutorial.ppt(20页珍藏版)》请在麦多课文档分享上搜索。
1、AIBO Tutorial,CS 4631 Spring 2004Ram Ravichandran,Outline,IntroductionBasic OPENR Program ConstructsCode DevelopmentExecuting and DebuggingFlow of DevelopmentParting advice,Introduction,EnvironmentCode developed using C+, OPENR APIInstalled under /usr/OPENR_SDKavailable from Documentation (availabl
2、e under /usr/OPENR_SDK/documentation )AIBO Programming manualERS-210 InformationAPI Specifications (Level II reference Guide),Introduction,Sample ProgramsBest way to learn writing codeAll sample programs are available under /usr/OPENR_SDK/sample Copy to your home directory and change permissions.run
3、 using make PREFIX=/usr/OPENR_SDK,OPENR Objects,True OO (very similar to Squeak/SmallTalk)Similar to a UNIX processCommunication 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.Argume
4、nts to the method is the data in the messageWait for more messages.,Inter-object communication,Brief overviewSubjectObject that sends a messageObserverObject that receives the messageEvery observer has a message queue.Subject sends Observer a NotifyEvent. Observer replies with a ReadyEventASSERT_REA
5、DYDEASSERT_READY,Core Class,Each Object has a Core ClassA Sample Core Class#include #include #include #include “def.h“class SampleClass : public OObject public: SampleClass(); virtual SampleClass() OSubject* subjectnumOfSubject; OObserver* observernumOfObserver;,Core Class (2),Continued virtual OSta
6、tus DoInit(const OSystemEvent,Inter-object Communication,Control MethodUsed by the Subject to receive a connection resultConnect MethodUsed by observer to receive a connection resultNotify MethodUsed by Observer to receive a messageReady MethodUsed by Subject to receive the ASSERT_READY and DEASSERT
7、_READY signals from Observer.,DoXXXX() Method Macros,DoInitNEW_ALL_SUBJECT_AND_OBSERVERRegisters the necessary number of Subjects & Observers.REGISTER_ALL_ENTRYregisters the connection to services offered by other objects SET_ALL_READY_AND_NOTIFY_ENTRYThis registers all entry points. DoStartENABLE_A
8、LL_SUBJECT Enables all the SubjectsASSERT_READY_TO_ALL_OBSERVERThis sends ASSERT_READY to all subjects.,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()DE
9、LETE_ALL_SUBJECT_AND_OBSERVER This deletes all observer and subjects.,More Message Passing,Observer first sends all its subjects an AssertReady void SampleObserver:SendAssertReady() observerobsfunc1-AssertReady( ); When Subject receives AssertReady, it sends the data. void SampleSubject:Ready(const
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- AIBOTUTORIALPPT
