Page 232 - The Ultimate Palm Robot
P. 232

Color profile: Generic CMYK printer profile
           Composite  Default screen
                                                          Bots /The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 8






                                                   Chapter 8  Taking Control of the BrainStem Robot  215



                                      To disable the auto-launch, you simply need to pass an invalid slot ID for
                                    the final parameter:

                                   2 18 15 255
                                   2 19
                                      One final note: when you create programs that you plan to auto-launch, the
                                    first thing the program should do is go to sleep for a few seconds. This allows the
                                    BrainStem to complete its bootup and initialization before the auto-launched
                                    programcontinuesexecuting.Recallfromthechase.teaandsimple.teaprograms
                                    that we’ve looked at that Acroname uses a five-second delay.

                                    Writing Your Own TEA Programs

                                    At this point, you should be ready to begin writing and executing your own
                                    TEA programs on the BrainStem. There are many useful functions contained
                                    in the library files in the aSystem directory. But for the most part, you only
                                    need a few things to get started with TEA:
                                        ❏ The TEA file that is the starting point for your program must
                                           have a main( ) function.
                                        ❏ You can read sensors with the aA2D_ReadInt(char) function.
                                           Use one of the predefined constants APPRK_IR1, APPRK_IR2,
                                           or APPRK_IR3 as arguments to this function.
                                        ❏ You can command the servos with the aPPRK_Go(char,char,char,char)
                                           function. Note that the arguments are defined as chars to force
                                           you to pass arguments in the range 0 to 255.
                                        ❏ You can pause the program with the aCore_Sleep(int) method.


                         Program the BrainStem Using Reflexes

                                    Our whole point in writing this chapter has been to show you how to use what
                                    you already know to program your robot. This section is going to violate that
                                    purpose.Whileusingreflexesisn’tthatdifficult,itisnotsomethingyouprobably
                                    already know how to do. It consists of new concepts and a new programming
                                    language that you would need to learn. For those reasons, we will not spend a
                                    great deal of time on reflexes. If, after reading this section, you want to pursue
                                    reflexes in more detail, you should consult the reference manual provided
                                    with the Acroname software.









           P:\010Comp\Bots\880-6\ch08.vp
           Monday, May 12, 2003 1:16:46 PM
   227   228   229   230   231   232   233   234   235   236   237