Boy-Scout and Follower
Robolab 2.5 offers some very exciting features. Among those are the possibility to program an RCX not only from the computer, but also from another RCX. The 2.0 firmware allows this through opcode 0x2C (SendUARTData) combined with indirect addressing. The creators of Robolab did a great job to write (or should we say draw) some reliable code, which is not evident since you have to respect a certain transmission protocol (toggling a bit for same opcode consecutively...). Lego Mindstorms SDK 2.0 warns users that 0x2C-opcode may cause "catastrophic" results. Not to forget that the second RCX sends replies, which should not be taken account by the sending RCX.
Here now an interesting application:
Imagine a honeybee searching for rich nectar flowers. Having found them, it returns to the bee-hive and through the famous bee-dance she tells her sisters how to fly to reach the flowers. Or, think about a dance-teacher who shows some steps to his pupils wishing them to imitate him as well as possible.
We programmed that kind of mission. BOY-SCOUT, equipped with bumpers, explores a room and fills its memory with the collected information. At memory-full-event or time-overflow-event or at a message from the remote control the robot stops and stores all the information directly into the memory of FOLLOWER.
What is new here is the fact that BOY-SCOUT collects information about its motor-status and the relative time. The information is encoded to fit in the integer-number limits, and put DIRECTLY into the containers of FOLLOWER. Then BOY-SCOUT starts the program of FOLLOWER. If FOLLOWER has executed all the movements (minus the last one - a persistent problem) it starts the program of BOY-SCOUT and so on, and so on.
Thus BOY-SCOUT is not collecting any positioning-information, but only its own motor effort.
(Main program is named Spurbiene2.vi)
The Scout.vi uses the Motorstatus_Container.vi which we introduced at the RoboSoccer2-project. The information about direction and on/off state are extracted from the motorstatus-variable and coded according to the follwing list:
Note the use of the reset-all-containers-icon which we introduced with RoboSoccer1. Remark the presence of event-icons and local variables.
The transmission of the information is a bit ugly, since here Robolab does not permit indirect addressing. The Fill_remote_container must be used for all the 32 variables.
The information must be decoded and executed. This is done in execute2.vi.
Note the use of the FOR-NEXT-icons introduced at RoboSoccer1.
DOWNLOAD the files.