URBI Tutorial for Urbi 1.0 (book compiled from Revision 245M) Jean-Christophe Baillie Mathieu Nottale Benoit Pothier URBI Tutorial for Urbi 1.0: (book compiled from Revision 245M) by Jean-Christophe Baillie, Mathieu Nottale, and Benoit Pothier Published Copyright © 2006-2007 Gostai™ This document is released under the Attribution-NonCommercial-NoDerivs 2.0 Creative Commons licence (http://creativecommons.org/licenses/ by-nc-nd/2.0/deed.en). Table of Contents 1. Introduction ................................................................................................................................... 1 2. Installing URBI .............................................................................................................................. 2 Installing the memorystick for Aibo ............................................................................................... 2 3. First moves .................................................................................................................................... 5 Setting and reading a motor value ................................................................................................. 5 Setting speed, time or sinusoidal movements ................................................................................... 6 Discovering variables .................................................................................................................. 6 General structure for variables .............................................................................................. 7 Device values and .val alias .................................................................................................. 7 Making "global" variables .................................................................................................... 7 Expressions ....................................................................................................................... 7 Lists ......................................................................................................................................... 8 Running commands in parallel ...................................................................................................... 8 Conflicting assignments ............................................................................................................... 9 Useful device variables and properties .......................................................................................... 10 Useful commands ..................................................................................................................... 10 4. More advanced features .................................................................................................................. 12 Branching and looping ............................................................................................................... 12 if .................................................................................................................................... 12 while .............................................................................................................................. 12 for, foreach ...................................................................................................................... 13 loop, loopn ...................................................................................................................... 13 Event catching mechanisms ........................................................................................................ 13 at ................................................................................................................................... 13 whenever ......................................................................................................................... 14 wait, waituntil .................................................................................................................. 14 timeout, stopif, freezeif ...................................................................................................... 14 Soft tests ......................................................................................................................... 15 Emit events ...................................................................................................................... 15 Command tags, flags and command control ................................................................................... 16 Objects grouping ...................................................................................................................... 17 Function definition .................................................................................................................... 18 Error messages and system messages ........................................................................................... 19 5. Objects in URBI ........................................................................................................................... 20 Defining a class ........................................................................................................................ 20 Virtual methods and attributes ..................................................................................................... 21 Groups .................................................................................................................................... 22 Broadcasting ............................................................................................................................ 23 6. The ball tracking example .............................................................................................................. 25 Ball detection ........................................................................................................................... 25 The main program .................................................................................................................... 25 Programming as a behavior graph ................................................................................................ 27 Controlling the execution of the behavior ...................................................................................... 28 7. Images and sounds ........................................................................................................................ 30 Reading binary values ............................................................................................................... 30 Setting binary values ................................................................................................................. 30 Associated attributes .................................................................................................................. 31 Binary operation examples ......................................................................................................... 32 8. The liburbi in C++ ........................................................................................................................ 33 What is liburbi? ........................................................................................................................ 33 Components and liburbi ............................................................................................................. 33 iv URBI Tutorial for Urbi 1.0 Getting started .......................................................................................................................... 34 Sending commands ................................................................................................................... 34 Sending binary data and sounds .................................................................................................. 35 Receiving messages ................................................................................................................... 35 Data types ............................................................................................................................... 36 UMessage ........................................................................................................................ 36 UValue ........................................................................................................................... 36 UBinary .......................................................................................................................... 37 USound ........................................................................................................................... 37 UImage ........................................................................................................................... 37 Synchronous operations ............................................................................................................. 38 Synchronous read of a device value ..................................................................................... 38 Getting an image synchronously .......................................................................................... 38 Getting sound synchronously .............................................................................................. 38 Conversion functions ................................................................................................................. 39 The "urbiimage" example ..........................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages69 Page
-
File Size-