BAMBINO 20m2 User Manual ======================== 17 July 2017 @Bambino-47.bas Overview - Bambino's Optical Sensors - Bambino's Ultrasonic Sensor - Bambino's Servos - TVR010 infra-red remote-control Getting started with Bambino Using Bambino - Operating Bambino - To Record a simple Act - To Record a repeating Act - To chain to another Act at the end of a recording - To Record repeating Acts - To include a Subroutine act, SAct, in an Act - To tell Bambino what to do when it is switched on - Bambino's sensor behaviour - Testing for obstacle/holes - Setting Bambino's behaviour - Setting User values for the Ultrasonic behaviour - Advanced behaviour - vitality - Other - Appendix 1 - setting the servos with Bambino-08+.bas - Appendix 2 - BambinoCommands: using TVR010_PicAxe_IR_controller - Appendix 3 - List of programs in the Bambino Suite - Appendix 4 - Rationale for programs in the Bambino Suite --------------------------------------- Bambino has been designed as a low cost, user programmable, autonomous biped robot kit. To get the best out of Bambino it is recommended that you learn to program the PicAxe20m2 microcontroller brain in the Basic programming language built into the PicAxe system. There is a complete suite of programs which start with flashing an LED and end with a complete robot program which allows Bambino to be controlled and taught from the PicAxe TVR010 infra-red remote-control. Loading each of these programs in turn into Bambino and studying how they are written together with making the suggested program modifications and noting the results will show you how you to develop the complete control program by building it up in simple steps. Overview ======== Bambino has - two motors called servos, one makes Bambino lean to the left, right, or stand upright and the other servo moves the legs forwards and backwards. By doing this in the right sequence Bambino will walk or turn; - one forward facing ultrasonic distance sensor for detecting objects in front; - two downward facing orange lights (LEDs) and two downward facing light sensors (photo-transistors) for detecting the edges of tables etc; - two forward facing orange lights (LEDs) and two forward facing light sensors (photo-transistors) for detecting objects in front; - one speaker; - one red LED; - one infra-red sensor for detecting commands from the TVR010 infra-red remote control or other controller using Sony codes; - one infra-red light (LED) to send commands to another Bambino. The battery consists of three AA cells housed in the black box on the top of Bambino. There is an on/off switch at the top right hand corner of the circuit-board. The connector at the top of the circuit-board is for programming Bambino and for accepting commands from a PC or other computer. Bambino's Optical Sensors ------------------------- Bambino senses the presence or absence of objects by measuring the difference in reflected light with the Orange LEDs On and Off. There are two forward facing phototransistor sensors shielded with black tubing. There are two downward facing phototransistor sensors shielded with black tubing. For the forward facing sensors if more light is falling on them when the LEDs are lit then there is probably an obstacle there. It may be that the obstacle doesn't reflect much light in that case Bambino will not see it! For the downward facing sensors if there is less light falling on them when the LEDs are lit than when they last self calibrated when Bambino is switched on or at the start of Wander then there is probably a hole such as at a table edge. If Bambino calibrates the hole sensors while on a black surface then it probably won't see holes. Bambino's Ultrasonic Sensor --------------------------- The sensor works by making a high frequency sound and timing how long it takes to hear the echo, a simple calculation then allows Bambino to know the distance to the object. Bambino's Servos ---------------- A Servo is a motor, gearbox and electronics combined in one unit. The position of the output shaft can be set by sending command pulses to the servo where the angular position of the shaft depends on the length of the pulse. The angle can vary over +-45 degrees as the pulse varies from 1ms to 2ms long and the pulse should be repeated every 20ms. The PicAxe20m2 can easily be programmed to do that. TVR010 infra-red remote-control ------------------------------- Before use, the transmitter must be programmed with the ‘Sony’ transmit code. 1. Insert 2 AAA size batteries, preferably alkaline. 2. Press ‘S’ and ‘B’ at the same time. S is in the centre of the arrows. The top left red LED should light. 3. Press ‘0’. The LED should flash. 4. Press ‘1’. The LED should flash. 5. Press ‘3’. The LED should go out. 6. Press the red power button (top right). The red button is [POWER]; buttons [A] [B] [C] [D] [E] [F] [G] change the Mode, Bambino only works with mode [B], if Bambino stops responding then press [B]; the direction buttons are [KEY_UP] or [Fd] Step Forward [KEY_DOWN] or [Bk] Step Backward [KEY_RIGHT] or [Rt] Step Right [KEY_LEFT] or [Lt] Step Left; [Key_S] is in the centre of the arrows (only used to setup the controller); below are the four function keys [KEY_BAR] or [f|] learn an Act, next [key] selects an Act [KEY_TENT] or [f^] next [key] selects a Subroutine-Act [KEY_VERT_CROSS] or [f+] Modify Mode [KEY_DIAG_CROSS] or [fX] transfer EEPROM to PC for including in programs; then below are the number keys [1] to [9], and [-], [0], [+]; the six keys at the bottom do nothing at all. ------------------------------------------------------------------ Getting started with Bambino ============================ Bambino comes either as a kit of parts including the fully built circuit board with the PicAxe20m2 brain, or as a fully assembled robot. If you have the kit then after you have assembled Bambino you should work your way through the supplied programs loading each one into Bambino in turn. Even if you only want to use the full robot control program you will first have to setup the servos before loading it. See Appendix 1 - seting the serovs with Bambino-08+.bas. This rest of this manual will show what Bambino is capable of with its full robot control program. Using Bambino ============= Using the full robot-control program Bambino can be taught up to eight Acts, each of up to 32 moves. The program records the moves into EEPROM memory so Bambino remembers the moves even when switched off. These Acts are selected by the buttons [1] to [8]. Act [8] is special in that it starts to play as soon as Bambino is switched on. Any of the Acts can chain to any other Act and even to itself so Bambino can repeat moves forever. An Act can also invoke or call a Subroutine Act (SAct) written in the Basic program. After an SAct finishes the original Act will carry on playing. Bambino can also Wander about autonomously using the Optical and Ultrasonic sensors to avoid obstacles and table edges. No sensors give perfect readings and Bambino only has a little brain so not every obstacle or edge will be seen, even humans walk into things or fall down a step so do not be surprised if and when Bambino doesn't see some obstacle or walks off the edge of a table. Contents -------- - Operating Bambino - To Record a simple Act - To Record a repeating Act - To chain to another Act at the end of a recording - To Record repeating Acts - To include a Subroutine act, SAct, in an Act - To tell Bambino what to do when it is switched on - Bambino's sensor behaviour - Testing for obstacle/holes - Setting Bambino's behaviour - Setting User values for the Ultrasonic behaviour - Advanced behaviour - vitality - Other - Appendix 1 - setting the servos with Bambino-08+.bas - Appendix 2 - BambinoCommands: using TVR010_PicAxe_IR_controller - Appendix 3 - List of programs in the Bambino Suite - Appendix 4 - Rationale for programs in the Bambino Suite Operating Bambino ----------------- [POWER] stop buttons [1] to [8] and [0] play an Act or Wander To stop Bambino press the [POWER] button on the TVR010. When stopped and waiting for a command Bambino's eyes will be dim. To play an Act press the relevant number button [1] to [8]. To get Bambino to Wander press button [0] When Bambino is stopped pressing button [Fd] will cause Bambino to take a step forward. When Bambino is stopped pressing button [Bk] will cause Bambino to take a step back. When Bambino is stopped pressing button [Lt] will cause Bambino to turn left one step. When Bambino is stopped pressing button [Rt] will cause Bambino to turn right one step. Note that Bambino turns by sliding its feet, sometimes it has to take a step before its feet are in the right position to turn. To play an SAct press the function button [f^] then the number button [1] to [8] for the desired SAct. currently there is only one in the supplied control program, SAct #1 - RockADo To Record a simple Act ---------------------- [f|] press function button [f|] to enter Record mode; press a number button [1] to [8] for the Act you wish to record. If you press any other button Bambinos down sensors will blink to indicate an incorrect button. While Bambino is waiting for a button to be pressed the mouth LED will light. To just quit without recording any moves press [POWER] twice, the first time the mouth LED will go out and the second time the eyes will glow dim indicating Bambino is stopped. To recap, to record press [f|] then a number button [1] to [8] Bambino's eyes will go out and the mouth LED will light. Press [Fd],[Bk],[Rt],[Lt] as desired. Bambino will beep when a command is received and the mouth LED will go out while the command is being done. When it is finished the mouth LED will light indicating Bambino is waiting for the next command. When you have finished press [POWER] to end recording. If you try and enter too many moves Bambino will beep and the recording will end automatically. When recording has ended Bambino's will glow dim. The Act can be played by pressing the number button for the Act. To Record a repeating Act ------------------------- Record as for a simple Act but before pressing [POWER] press the number button for the Act you are recording then press [POWER]. eg [f|] [2] [Fd] [2] [POWER] Will select recording of Act 2, record a Forward one step command [Fd], record a command to play Act 2 then [POWER] ends recording. So if you press [2] to play Act 2 Bambino will take a step forward and then play Act 2 again, so Bambino will walk forwards forever or until you press [POWER] or turn it off To chain to another Act at the end of a recording ------------------------------------------------- As before but instead of pressing the button for the Act you are recording, press the number button for the Act you wish to do next. eg [f|] [3] [Rt] [Rt] [2] [POWER] Now Act 3 when played will cause Bambino to turn right twice then play Act 2. To Record repeating Acts ------------------------ Make a new recording [f|] [2] [Fd] [Fd] [Fd] [3] [POWER] Now when you press [2] to play Act 2, Bambino will step forward three times then play Act 3. If Act 3 is still [f|] [3] [Rt] [Rt] [2] [POWER] Act 3 will make Bambino turn right twice then play Act 2. So Bambino will continually take three steps forward and two steps right, again until you press [POWER]. To include a Subroutine act, SAct, in an Act -------------------------------------------- Note There are only three SAct included in the program, SActs #1 RockADo. #18 RollRight, #19 RollLeft Lets record Act 4 to do Forward one step then include RockADo and repeat, remember [f^] from above selects Subroutine acts [f|] [4] [Fd] [f^] [1] [4] [POWER] press [4] to play the act. To tell Bambino what to do when it is switched on ------------------------------------------------- By now you should have gathered that programming Bambino from the TVR010 remote-control is quite easy. Any button press can be recorded into an Act. We mentioned before that Act [8] is special in that it starts to play as soon as Bambino is switched on so if you want Bambino to Wander when it is switched on then simply record Act 8 as [f|] [8] [0] [POWER] Act 8 will then immediately start Wander. If you record [f|] [8] [f^] [1] [0] [POWER] when switched on Bambino will do RockADo and then Wander. Bambino's sensor behaviour -------------------------- When an obstacle or hole is detected by the optical sensors Bambino will try and avoid it by turning and or stepping back and remember whether the obstacle/hole was to the front or right or left. If another obstacle/hole is now seen then Bambino will remember two obstacles/holes, if there are more than two obstacles/holes then Bambino will step back before turning. At each step Bambino forgets a bit about the obstacles/holes and will go back to just turning away from them. When an obstacle is detected by the Ultrasonic sensor if it is further away than some distance, let's call it US-AwareAt, then the obstacle is ignored. If the obstacle is nearer, but not too close then Bambino just turns. If the obstacle is closer than some distance, let's call it US-TooNear, then Bambino will make a 'squak' noise and step back and turn away. Testing for obstacle/holes -------------------------- [-] enable the Optical sensors and run tests for obstacles and holes [+] enable the Ultrasonic sensor and run the test for obstacles pressing [-] will enable the Optical sensors and run tests for obstacles and holes, pressing [+] will enable the Ultrasonic sensor and run the test for obstacles, these commands can be recorded in Acts. When the Act is run if when those commands are executed the sensor tests show there is an obstacle or hole then the appropriate action will be done before Bambino carries on with the rest of the commands in the Act. Setting Bambino's behaviour --------------------------- [9][1] slow [9][2] medium [9][3] fast [9][4] timid [9][5] normal [9][6] bold [9][7] disable optical sensors [9][8] disable ultrasonic sensor [9][9] use USER ultrasonic settings [9][0] default vitality [9][Fd] increase vitality [9][Bk] decrease vitality [9][KEY_UP] B_faster: - increase speed [9][KEY_0] B_normal: - normal speed [9][KEY_DOWN] B_slower: - decrease speed Bambino can walk slowly, or medium, or fast. To set slow press [9] then [1] To set medium press [9] then [2] To set fast press [9] then [3] Bambino can be timid, normal or bold in response to the Ultrasonic distance readings. If Bambino is timid then US-TooNear =15 cm US-AwareAt =30 cm If Bambino is normal then US-TooNear =10 cm US-AwareAt =20 cm If Bambino is bold then US-TooNear =5 cm US-AwareAt =10 cm To set timid press [9] then [4] To set normal press [9] then [5] To set bold press [9] then [6] We said that no sensor was perfect and Bambino's optical sensors can be affected by Halogen lights or bright sunlight and the readings can be affected by the colour of the obstacles or floor or table. If when Wandering Bambino is avoiding things which are not there then the optical sensors can be turned off To turn off the Optical sensors press [9] then [7] When the battery is running down the Ultrasonic sensor can give false reading and when Wandering Bambino can think there is an obstacle when there isn't one. If this happens the Ultrasonic sensor can be turned off. To turn off the Ultrasonic sensors press [9] then [8] In addition US-TooNear and US-AwareAt can be set by the user (see below) To use those values press [9] then [9] Again all these commands can be recorded in Acts. eg [f|] [1] [9] [1] [Fd] [Fd] [9] [2] [Fd] [Fd] [9] [3] [Fd] [Fd] [1] [POWER] Will create an Act 1 where Bambino is set to slow then takes two steps forward, is set to medium and takes two steps forward, is set to fast and takes another two steps forward, then repeats that forever. Setting User values for the Ultrasonic behaviour ------------------------------------------------ [f+] then do [-] set US-TooNear, [+] set US-AwareAt as required [POWER] to quit place an obstacle in front of Bambino press [f+] to enter modify mode press [-] to set US-TooNear press [+] to set US-AwareAt press [POWER] to end Advanced behaviour - vitality ----------------------------- [9][Fd] increases vitality [9][Bk] decreases vitality [9][0] default vitality It is possible to alter the vitality of Bambino over something like a +30% to -50% range. Pressing [9] then [Fd] increases the vitality by about 10% each time up to the maximum of +30%. Pressing [9] then [Bk] decreases the vitality by about 10% each time to a minimum of -50%. Pressing [9] then [0] restores the vitality to the default setting. The changed vitality is not remembered when Bambino is turned off Again these commands can be recorded in Acts. Other ----- [fX] send the contents of the EEPROM memory to a PC over the programming link at 38400 baud More for those programming Bambino in Basic using the PicAxe IDE. Pressing [fX] will send the contents of the EEPROM memory to a PC over the programming link at 38400 baud in a format suitable for pasting into another Basic program. It is best not to use the Serial Terminal in the PicAxe IDE for this. I use Br@ys Terminal or preferably Parallax's Serial Terminal. ======================================================================== Appendix 1 - setting the servos with Bambino-08+.bas ===================================================== Note that this can also be done by using programs #32 to #36, in which case Bambino can be commanded to step forwards, backwards and to turn so the values for RollC and PaceC can be fine tuned. The routine is exactly the same as in #08+. Bambino-08+.bas =============== Switch on Bambino and load Bambino-08+.bas using the PicAxe Programming Editor. This allows you to set the mid positions of both servos. Because of the way each servo is made and the horns can only be put on about every 15 degrees the feet may not be exactly side by side or flat on the ground. Adjust the Roll servo so Bambino stands up straight and doesn't lean to the left or right. Adjust the Pace servo so Bambino stands with both feet side by side. Select the servo ---------------- Using the TVR010 infra-red remote-control - press either the [LEFT] or [RIGHT] button to select the Roll servo, press either the [UP] or [DOWN] button to select the Pace servo, for the Roll servo the right down LED will light, for the Pace servo the left down LED will light. Adjust the servo ---------------- Adjust the servos using the [-] and [+] buttons The [-] and [+] buttons are by button [0]. Press either the [+] or [-] buttons to adjust the servo position [+] roll right, [-] roll left [+] left foot forwards, [-] left foot backwards to quit without saving press the [0] buttons, when the servo position is good press the [POWER] buttons, the down LEDs will go out and the mouth LED will light, if you press other buttons then the eyes will say no. Adjust both servos. The calibrated values are stored in EEPROM for further programs. You can Open a serial terminal @4800 baud to see the values. [Note - the early programs used 4800 baud, from #45 they use 38400 baud.] ======================================================================== Appendix 2 - BambinoCommands: using TVR010_PicAxe_IR_controller =============================================================== The following synopsis of key usage, from Bambino-46.bas, may be useful. BambinoCommands: 'using TVR010_PicAxe_IR_controller '-------------------------------------------------- ' '[KEY_POWER] stops a learned Act and enters Command mode. ' ends modify mode, ends learning ' it can't stop a subroutine Act ' 'Direction Keys '-------------- '[KEY_UP] ie [Fd] Step Forward '[KEY_DOWN] ie [Bk] Step Backward '[KEY_RIGHT] ie [Rt] Step Right '[KEY_LEFT] ie [Lt] Step Left ' 'Function Keys '------------- '[KEY_BAR] ie [f|] enters learn mode to record key presses ' has to be followed by a number key 1-8 ' = the Act to be remembered ' up to 8 Acts can be learned ' learned Acts can call subroutine Acts 'Acts can chain to other Acts, eg Fd,Bk,2 - chain to Act2 'A learned Act which chains itself repeats forever, 'eg [f|][1][Fd][1][POWER] Act1 will do Fd forever '[KEY_TENT] ie [f^] selects subroutine Acts = SAct, ' has to be followed by a number key 1-8 ' plays SActs, SActs play until the end. ' [KEY_1] is RockAdo '[KEY_VCROSS] ie [f+] modify USawareAt, UStoonear ' [+] set USAwareAt in EEPROM DUSawareAt ' [-] set UStoonear in EEPROM DUStoonear ' [Key_POWER] to quit '[KEY_XCROSS] ie [fX] Dump EEPROM Acts DATA to PC, including Config Data ' 'Act Keys '-------- '[1] to [8] Play an Act '[f^][1] to [f^][8] Play a subroutine Act 'When Recording an Act, ' [1]-[8] record a jump to a new Act ' if [1],[2],[3],[4],[5],[6],[7].[8],[0] are used to jump to ' another Act there is no point in recording more moves because they ' will never be replayed since control is transfered to the new Act, ' just press [KEY_POWER] to end the recording; ' [f^] then [1]-[8] to do and include a Subroutine Act (SAct); ' when the memory slot is full Bambino will beep and recording will end. 'Act8 Autoruns on PowerOn ' On poweron to WANDER do [f|][8][0][Power] ' enter command mode do [f|][8][Power] ' WANDER B_slow do [f|][8][9][1][0][Power] ' run Act1 do [f|][8][1][Power] ' do SAct1 then Act1 do [f|][8][f^][1][1][Power] ' etc 'Act0 is WANDER and cannot be changed ' 'Behaviour Key '------------- '[9] Behaviour mode eg [9][1] set speed slow ' [1] set speed slow ' [2] set speed medium ' [3] set speed fast ' [4] set US behaviour to timid ' [5] set US behaviour to normal ' [6] set US behaviour to bold ' [7] disable Whiskers test ' [8] disable Ultrasonic test ' [9] set US behaviour to User values set by handset ' [KEY_UP] B_faster: - increase speed ' [KEY_0] B_normal: - normal speed ' [KEY_DOWN] B_slower: - decrease speed ' 'Sensor Keys '----------- '[-] enable and test Whisker sensors and re-act, R_Whiskers: '[+] enable and test Ping sensor and re-act, R_Ping: ' 'Activity Key '------------ '[0] WANDER ' ' 'Quirks '------ ' If you are recording Act1 and press [f|][2] then you will start 'to record Act2 and Act1 will be left without placing an end marker. 'If Act1 is then played the new moves will be played then whatever 'moves remained there from before. 'If you enter record mode but press [POWER] before pressing a valid 'Act key [1] - [8] then until you press [POWER] a second time and 'Bambino's eyes glow dim any commands will be recorded in Act #6. 'There is no room left to correct this! ======================================================================== Appendix 3 - List of programs in the Bambino Suite ================================================== This suite of programs will take you through all the programming steps from flashing an LED, to controlling the servos to a fully fledged control program where Bambino can be controlled and programmed from the TVR010_PicAxe_IR_controller or other TV style infra-red remote controls which use the Sony protocol. The final program #45 will allow you to program Bambino from the IR_controller with up to eight Acts each of thirty two commands, where each Act can be chained to any other Act or even to itself allowing never ending activities. Act8 will autorun on PowerOn so Bambino can start off doing what you want it to do. The commands allow full movement and speed control, altering the threshold parameters for the ultrasonic sensor, as well as activating the ultrasonic or whisker sensors and acting on the result. Taught commands can even be transfered to the PC from where they can be loaded into another Bambino. So lets get started on the journey and explore how we can bring Bambino to life. It is recommended that you load and run each program even if you are an experienced programmer and if not then the programs will teach you in small easy to understand steps how to write a programs for Bambino. Bambino_Suite: 'Bambino-00 all off, no activity so can probe board for voltages 'Bambino-01 Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 Test PWM of eyeLEDs 'Bambino-03 Test InfraRed input 'Bambino-04 Test Eye light values 'Bambino-05 Test Whisker light values 'Bambino-06 Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-07 Set servos to mid position 'Bambino-08 Calibrate servo mid positions and put in EEPROM. 'Bambino-08+ Adjust servo mid positions from Handset and put in EEPROM. 'Bambino-09 Introduce _iStand:- initialise with feet in mid position 'Bambino-10 Set rollby, rollbymax for Roll Right 'Bambino-11 Check rollby, rollbymax for Roll Left 'Bambino-12 Check rollby and rollbymax for rollR, rollL 'Bambino-13 Introduction of _Stand 'Bambino-14 Investigate effect of rollspeed; ' watch roll for all three speeds 'Bambino-15 Investigate effect of rollspeed; ' watch Roll and Stand for all three speeds 'Bambino-16 Check paceFL paceFR; Investigate effect of pacespeed ' Introduction of pulseservos: 'Bambino-17 Check Fd 'Bambino-18 Test Rt, Lt 'Bambino-19 Test Bk 'Bambino-20 Test T2l: TurntoLight: T2d: TurntoDark: Wl: Wd: 'Bambino-21 Creaton of sections ACTIONS, BEHAVIOURS, ACTS; ' Introduction of ACT parameter 'Ado' 'Bambino-22 Demo routine + example use of Start1: to flash eyes 'Bambino-23 Walk Fd with obstacles avoidance using eyes from 04, ' introduction of Default behaviour 'Bambino-24 Walk Fd with obstacles avoidance as 23, with Act BT 'Bambino-25 Walk Fd with drop-off avoidance using whiskers from 05 ' obstacle map extended to include holes 'Bambino-26 rewritten with reading of whiskers as subroutines 'Bambino-27 rewritten with autocalibration of down whiskers 'Bambino-28 Test maximum PWM and hence minimum brightness of eyeLEDs, ' needed in Bambino-29 'Bambino-29 Wait for IR command then do it otherwise WANDER as B24 'Bambino-30 rewrite to clearer code 'Bambino-31 remember a sequence of key presses on IR-controller 'Bambino-32 remember up to 7 sequences of key presses in RAM, ' forgotten on power off. ' Adjust RollC and PaceC added, easier to fine tune. 'Bambino-33 remember up to 8 sequence of key presses in EEPROM, ' now not forgotten. 'Bambino-34 obstacles memory made deeper for better obstacle avoidance, ' and put in RAM, Mfrus_obs introduced 'Bambino-35 key [0] can now be learned 'Bambino-36 incorporate drop-off avoidance from B25, ' remember holes and obstacles 'Bambino-37 PicAxe SRF05 Ultrasonic sensor added ' and facility to adjust ' USawareAt and UStoonear from IR-handset ' Adjust RollC PaceC removed to make room. 'Bambino-38 Added code to use either PicAxe SRF05 or an HC-SR04 ' Ultrasonic sensor with #defines for sensor type, ' cm or inches, and testUS. 'Bambino-39 added KEY_PLUS to test Ping sensor and act on result, ' can be put in learned routines. ' added poweron test of US, if <10 then disable US 'Bambino-40 revised use of LEDs for indicating holes/obstacles ' Separated Whisker and Ultrasonic actions in Walk: 'Bambino-41 added CASE KEY_9 '[9] Behaviour to select behaviours ' B_slow,B_medium,B_fast, ' B_UStimid,B_USnormal,B_USbold, ' B_noWhiskers,B_noUS ' B_USxxx now write to RAM 'Bambino-42 moved whisker testing and reaction to R_Whiskers ' added KEY_MINUS to test Whiskers and act on result ' removed test of US in INITIALISE:, not needed now on keys[9][8] 'Bambino-43 Act#8 made autorun ' On poweron to WANDER do [|][8][0][Power] ' command mode do [|][8][Power] ' WANDER B_slow do [|][8][9][1][0][Power] ' run Act1 do [|][8][1][Power] ' do CAct1 then Act1 do [|][8][^][1][1][Power] ' etc 'Bambino-44 updating of RAMobstaclesX ' removed from Whisker sense routines, put in R_whiskers: ' moved testing of DUSvalues and updating of RAMUS to B_USuser: ' [9][9] runs B_USuser: to get USuser distance values from EEPROM 'Bambino-45 program now runs @32MHz except when pulsing Servos and Beeping ' Beeping didn't sound right @32MHz ' Servos pulsed @4MHz to keep 10us resolution which fits in a byte 'Bambino-46 adjusment of sframe to fine adjust speed 'Bambino-47 [^][<]RollL and [^][>]RollR made, SERTXD("F") etc commented ' for kicking a ball '================================================================= Appendix 4 - Rationale for programs in the Bambino Suite ======================================================== 'Bambino-00 all off, no activity so can probe board for voltages '----------------------------------------------------------------- Rationale: 'With Bambino moving about it is very difficult to test the control 'board so we start off with a program which does nothing. 'Bambinos with ready built boards should never need this program. '================================================================= 'Bambino-01 Test eyeLEDs, whiskerLEDs and speaker '----------------------------------------------------------------- Rationale: 'The program makes a sound and toggles the four orange LEDs. 'This uses ' - the Speaker and red Mouth LED, ' - the four orange LEDs '================================================================= 'Bambino-02 Test PWM of eyeLEDs '----------------------------------------------------------------- Rationale: 'The only way to see what is the effects of different PWM values 'is to try them and see. 'The following code PWMs the Eye LEDs, 'first the Right eye at 10KHz then the Left Eye at ~40kHz 'first the Right eye at 10KHz then the Left Eye at ~4kHz 'Since to me there is no visual difference I think it is easier to use 'period =24, then duty can run from 100 to 0 same as a percentage. '================================================================= 'Bambino-03 Test InfraRed input '----------------------------------------------------------------- Rationale: 'Test InfraRed input '------------------- ' receive IR code and send it to the PC; ' open the Terminal window [F8] to see the codes; ' set the baud to 4800; ' if you are not using the PicAxe controller TVR010 ' then you will need to write down which keys give which codes; '================================================================= 'Bambino-04 Test Eye light values '----------------------------------------------------------------- Rationale: 'Test Eye light values '--------------------- ' open the Terminal window [F8] to see the values; ' set the baud to 4800; ' read the analog light values using READADC '================================================================= 'Bambino-05 Test Whisker light values '----------------------------------------------------------------- Rationale: 'Test Whisker light values '------------------------- ' open the Terminal window [F8] to see the values; ' set the baud to 4800; ' read the analog light values using READADC 'edit holedetect values so Bambino can see table edges 'detected values should 'be greater than the holedetect values when not at an edge 'and lower when at an edge. '================================================================= 'Bambino-06 PLAY the inbuilt tunes using keys 1 to 4 and beep on 5 '----------------------------------------------------------------- Rationale: 'Time for a little fun! 'PLAY the inbuilt tunes using keys 1 to 4 and beep on 5 '------------------------------------------------------ '[key1] tune 0 - Happy Birthday '[key2] tune 1 - Jingle Bells '[key3] tune 2 - Silent Night '[key4] tune 3 - Rudolph the Red Nosed Reindeer '[key5] beep '================================================================= 'Bambino-07 Set servos to mid position '----------------------------------------------------------------- Rationale: 'Servos require a control pulse, nominally between 1ms and 2ms, 'repeated nominally every 20ms. 'A pulse of 1.5ms will send a servo to its mid position. 'For a change from 1ms to 2ms the servo will rotate about 100 degrees, 'the direction and precise amount depends on the make and model of the servo. 'It is not.advisable to pulse servos more often than about every 15ms as some 'servos will smoke and self destruct. 'Pulsing at an interval of greater than 30ms will result in 'sluggish and weak movement. 'Set servos to mid position '-------------------------- ' remove horn screws ' remove horns from servos ' run program ' attach horns so ' feet are side by side ' feet are both flat on the ground ' fasten the horns with the screws '================================================================= 'Bambino-08 Calibrate servo mid positions and put in EEPROM. '----------------------------------------------------------------- Rationale: 'Calibrate servo mid positions. '----------------------------- 'The pulsout value must be between 100 and 200 ' otherwise the servo may be damaged. 'Because of the way each servo is made and ' the horns can only be put on about every 15 degrees ' the feet may not be exactly side by side or flat on the ground. 'Edit the servo mid positions, rollC and paceC, and ' reload the program until the feet are in the right position. 'The calibrated values are stored in EEPROM for further programs. 'If you want you can program Bambino with Bambino-08+.bas and use the ' infra-red-controller to adjust and store the rollC and paceC positions. ' and then carry on with Bambino-10. However you should read this program ' so you understand what is being done. '================================================================= 'Bambino-08+ Adjust servo mid positions from IR-Handset and put in EEPROM. '----------------------------------------------------------------- Rationale: 'This an easier way to do it than using Bambino-08. 'Studying the code will be useful for understanding later programs. 'Calibrate servo mid positions. '----------------------------- 'The pulsout value must be between 100 and 200 ' otherwise the servo may be damaged. 'Because of the way each servo is made and ' the horns can only be put on about every 15 degrees ' the feet may not be exactly side by side or flat on the ground. ' Use the infra-red-controller to adjust and store the rollC ' and paceC positions. 'Open a serial terminal @4800 to see the adjusted values if you want. ' To check the walking remove the programming cable otherwise ' it may pull Bambino to one side or the other 'To adjust the servos use the IRremote control ' press either the [left] or [right] keys to select the Roll servo, ' press either the [forward] or [backward] keys to select the Pace servo, ' for the Roll servo the right down LED will light ' for the Pace servo the left down LED will light ' press either the [+] or [-] keys to adjust the servo position, ' the [-] and [+] buttons are by button [0], ' [+] roll right, [-] roll left ' [+] left foot forwards, [-] left foot backwards ' To quit adjusting without saving press the [0] key, ' when the servo position is good press the [POWER] key, ' the down LEDs will go out and the mouth LED will light, ' if you press other keys then the eyes will say no. ' Adjust both servos.. 'To check walking press the [POWER] key and Bambino will walk forwards. ' This is so you can see if the settings are right, if they aren't ' then press the relevant direction key and adjust again. 'The calibrated values are stored in EEPROM for further programs. '----------------------------------------------------------------- 'TVR010 PicAxe IR-controller - Setup '----------------------------------- 'Before use, the transmitter must be programmed with the ‘Sony’ transmit code. '1. Insert 2 AAA size batteries, preferably alkaline. '2. Press ‘S’ and ‘B’ at the same time. S is in the centre of the arrows. ' The top left red LED should light. '3. Press ‘0’. The LED should flash. '4. Press ‘1’. The LED should flash. '5. Press ‘3’. The LED should go out. '6. Press the red power button (top right). '----------------------------------------------------------------- '================================================================= 'Bambino-09 Introduce _iStand:- initialise with feet in mid position '----------------------------------------------------------------- Rationale: 'Introduce _iStand:- initialise with feet in mid position 'Standing up straight in a known initial position is vital for biped robots. 'The subroutine _iStand: does that. '================================================================= 'Bambino-10 Set rollby, rollbymax for Roll Right '147 bytes '----------------------------------------------------------------- Rationale: 'Set rollby for Roll Right '------------------------- 'edit rollby and reload program ' until left foot is just off the ground 'edit rollby and reload program ' to find rollby so Bambino just doesn't tip over ' edit rollbymax to that value '================================================================= 'Bambino-11 Check rollby, rollbymax for Roll Left '166 bytes '----------------------------------------------------------------- Rationale: 'Check rollby, rollbymax for Roll Left '------------------------------------- 'check that the rollby set in #10 is good for rollL ' if necessary edit rollby and reload program ' until right foot is just off the ground. 'edit rollby and reload program ' to find rollby so Bambino just doesn't tip over ' if less edit rollbymax to that value '================================================================= 'Bambino-12 Check rollby and rollbymax for rollL, rollR ' save rollbyL and rollbyR in EEPROM '187 bytes '----------------------------------------------------------------- Rationale: 'Check rollby and rollbymax for rollL, rollR '------------------------------------------- 'edit rollby and reload program ' until left and right feet just leave the ground ' You might have to take out the download cable to ' check what is right, because it pulls the robot 'edit rollby with rollbymax and reload program ' until Bambino doesn't fall over 'edit rollby back to value for walking ' 'Investigate effect of rollspeed '------------------------------- 'edit rollspeed to see how Bambino performs 'also edit sframe to vary the time between servo pulses ' use values between 15 (fast) and 70 (slow) ' this can give finer tuning of the speed than rollspeed ' 'Investigate th effect of sframe '------------------------------- 'Slight differences between the motors and construction of Bambinos 'may mean your Bambino bounces over with rollby=15 and rollspeed=3 'if so then increase sframe up to maybe 25. This will make Bambino 'not so excited. '================================================================= 'Bambino-13 Introduction of _Stand '----------------------------------------------------------------- Rationale: 'rollby is now a variable and read from rollbyL and rollbyR in EEPROM ' 'Introduction of _Stand '---------------------- 'You might have to take out the download cable to 'check what is right, because it pulls the robot. 'Bambino - 'Rolls onto its Right foot 'Rolls onto its Left foot 'four times so we can see how Bambino rolls from one foot to the other ' 'Bambino then - 'Rolls onto its Right foot 'Stands upright using _Stand 'Rolls onto its Left foot 'Stands upright using _Stand 'four times so we can see how Bambino rolls from a foot to standing ' 'As you can see there is little difference, however ending each move 'with Stand means that at the end of a move Bambino is in a known Pose. '================================================================= 'Bambino-14 Investigate effect of rollspeed; ' watch roll for all three speeds '----------------------------------------------------- Rationale: 'Investigate effect of rollspeed with rollat a variable '------------------------------------------------------ 'watch roll for all three speeds ' You might have to take out the download cable to ' check what is right, because it pulls the robot. 'We want to check Bambino rolls smoothly and doesn't tip over 'Edit the program and see what happens when rollspeed is greater than 3 '================================================================= 'Bambino-15 Investigate effect of rollspeed; ' watch Roll and Stand for all three speeds '----------------------------------------------------------------- Rationale: 'Investigate effect of rollspeed '------------------------------- 'watch Roll and Stand for all three speeds ' You might have to take out the download cable to ' check what is right, because it pulls the robot. 'Edit the program and see what happens when rollspeed is greater than 3 '================================================================= 'Bambino-16 Check paceby; Investigate effect of pacespeed '----------------------------------------------------------------- Rationale: 'Check paceby '------------------- 'edit paceby and reload program for nice walking 'edit paceby and check pacebymax, edit paceby back to walking 'Investigate effect of pacespeed '------------------------------- 'eedit pacespeed to see how Bambino performs ' 'pulseservos: now has the code to pulse servos which makes the 'program easier to read. '================================================================= 'Bambino-17 Check Fd '----------------------------------------------------------------- Rationale: 'Check paceby '------------ 'edit paceby and reload program so walking is nice 'Investigate effect of rollspeed '------------------------------- 'edit rollspeed to see how Bambino performs '================================================================= 'Bambino-18 Test Rt, Lt '----------------------------------------------------------------- Rationale: 'Test Rt, Lt '------------- ' if turns right and left are not similar then adjust rollC again with #8 or #8+ '================================================================= 'Bambino-18 Test Rt, Lt '----------------------------------------------------------------- Rationale: 'Test Rt, Lt '------------- 'Turns depend on the friction between a foot and the floor being 'the same for each foot 'If turns right and left are not similar then adjust rollC with #8 or #8+ '================================================================= 'Bambino-19 Test Bk '----------------------------------------------------------------- Rationale: 'Test Bk '================================================================= 'Bambino-20 Test T2l: TurntoLight: T2d: TurntoDark: Wl: Wd: '474 bytes '----------------------------------------------------------------- Rationale: 'Test TurntoLight: TurntoDark '----------------------------- 'One of the simplest tasks a robot like Bambino can do is to walk 'towards bright lights, or walk towards dark areas. 'Here are introduced 'walktoLight:, 'walktoDark:, 'TurntoLight:, 'TurntoDark:, 'readeyes: 'these are also called Wd:, Wl:, T2l:, T2d: to save typing. 'To determine the light direction left or right, ' take readings from the eyes, ' find the difference ' shift by 128 to avoid negative numbers, ' 255 is left and 0 is right with 128 straight ahead, ' for going to light ' if greater than (128 + eyehyteresis) then turn left ' if less than (128 - eyehyteresis) then turn right ' for going to dark ' if greater than (128 + eyehyteresis) then turn right ' if less than (128 - eyehyteresis) then turn left '================================================================= 'Bambino-21 Creaton of sections ACTIONS, BEHAVIOURS, ACTS; ' Introduction of ACT parameter 'Ado' '435 bytes '----------------------------------------------------------------- Rationale: 'Creaton of sections ACTIONS, BEHAVIOURS, ACTS '--------------------------------------------- 'It helps to divide the program into sections that deal with ' - ACTIONS, things like taking a step ' - BEHAVIOURS - parameters like speed which control how an ACTION is done ' - ACTS, which are series of ACTIONS, governed by BEHAVIOURS 'Introduction of ACT parameter 'Ado' '----------------------------------- 'The ACTS like RockAdo repeat various ACTIONs a certain number of times, 'The variable Ado controls the number of repeats in the FOR/NEXT loops '================================================================= 'Bambino-22 Demo routine + example use of Start1: to flash eyes '598 bytes '----------------------------------------------------------------- Rationale: 'StartX (see Manual1 page 61) can be used for multitasking 'here it is used to flash the eyes whilst walking. 'Later programs do not use Starts because there was nothing I wanted 'Bambino to do in parallel. 'StartX is not useful for pulsing the servos. 'Also it should be noted that the PicAxe Servo command for pulsing 'the servos as a background task is not reliable for more than 'one servo and causes the servos to judder. '================================================================= 'Bambino-23 Walk Fd with obstacles avoidance using eyes from 04, ' introduction of Default behaviour '607 bytes '----------------------------------------------------------------- Rationale: 'Walk Fd with obstacles avoidance using eyes from 04 '--------------------------------------------------- 'Now we can start to make Bambino come alive. 'Bambino reads the two eyes and 'if there are obstacle sets the bits in the variable obstacles. 'If there is an obstacle to the left it turns on the left eyeLED 'If there is an obstacle to the right it turns on the right eyeLED 'The does Fd,Lt,Rt,Bk depending on the value of obstacles. '================================================================= 'Bambino-24 Walk Fd with obstacles avoidance as 23, with Act BT '623 bytes '----------------------------------------------------------------- Rationale: 'Walk Fd with obstacles avoidance using eyes from 04 '-------------------------------------------------- 'Simply stepping backwards if there are obstacles to the right and left 'as in #23 is not very useful, 'here is introduced BT which steps back twice and then turns. '================================================================= 'Bambino-25 Walk Fd with drop-off avoidance using whiskers from 05 ' obstacle map extended to include holes '661 bytes '----------------------------------------------------------------- Rationale: 'Walk Fd with drop-off avoidance using whiskers from 05 '------------------------------------------------------ 'As we saw in #05, Bambino can detect the edges of a table. 'program #24 is rewritten so Bambino avoids table edges. 'As with most sensors the results are not perfect and sometimes 'it will be obvious to a human that there is a table edge just 'in front of Bambino but which Bambino fails to see. 'If you have ever stepped of a curb and twisted your ankle you 'will know that human sensors are not infallible either! 'The obstacle map has been extended with two extra bits for holes. '================================================================= 'Bambino-26 rewritten with reading of whiskers as subroutines '651 bytes '----------------------------------------------------------------- Rationale: 'Walk Fd with drop-off avoidance '------------------------------- 'The reading of the whiskers has been moved to subroutines 'in the section 'Sense' '================================================================= 'Bambino-27 rewritten with autocalibration of down whiskers '742 bytes '----------------------------------------------------------------- Rationale: 'Walk Fd with drop-off avoidance '------------------------------- 'Optical sensor are tricky to get working 100% of the time. 'Sunlight tends to blind them and the high frequency flickering of 'artificial light, which we can't see, confuses them. 'Here a new routine calibrateholewhiskers: is introduced which 'takes an average of eight readings of the light reflected from 'the ground, ie table or wherever Bambino is walking. At each step 'Bambino then compares that value to the light from the ground 'to see if the value is less and if so the ground has probably 'gone away and there is a hole. '================================================================= 'Bambino-28 Test maximum PWM and hence minimum brightness of eyeLEDs, ' needed in Bambino-29 '112 bytes '----------------------------------------------------------------- Rationale: 'To alter the brightness of the eyeLEDs we need to use PWM 'Here I test PWM settings and the only way to do that is to run the 'program and see what is the efect on the LEDs. 'in Bambino-02 the code PWM'd the Eye LEDs, 'first the Right eye at 10KHz then the Left Eye at ~40kHz 'first the Right eye at 10KHz then the Left Eye at ~4kHz 'Remember when the pin is HIGH the LED is off 'and when the pin is LOW the LED is fully on 'The minimum brightness is going to be at 'the maximum duty cycle without being fully on, ie the LED being OFF. 'If the period is 24 then the maximum duty cycle is only 99 out of 100. 'But if the period is 255 then the maximum duty cycle is 1023 out of 1024. 'Here is added a last dim state of 255,1023 'and it can be seen to be dimmer than any of the other dimmest states. '================================================================= 'Bambino-29 Wait for IR command then do it otherwise WANDER as B24 '1001 bytes '----------------------------------------------------------------- Rationale: 'If IR command then do it otherwise walk and avoid '------------------------------------------------- 'Read in an Infra-red command from the TVR010 PicAxe IR-controller. 'And then GOSUB depending on the command. 'For simplicity only the forward looking eye sensors are used. ' 'Turns can be made by stepping forwards then sliding both feet 'or by stepping backwards then sliding both feet. If there is a big 'obstacle it is better to turn and back away which can be done by 'stepping backwards in a turn 'A flag variable f_direction is set to 1 if going forward and to 0 'if going backwards. In turns this controls which way to step. '================================================================= 'Bambino-30 rewrite to clearer code '1046 bytes '----------------------------------------------------------------- Rationale: 'As always when writting programs after they have been written they 'can be rewritten to be clearer. 'Here #29 is rewritten with a CASE command. '================================================================= 'Bambino-31 remember a sequence of key presses on IR-controller '1211 bytes '----------------------------------------------------------------- Rationale: 'The program can now record infra-red commands into RAM and replay 'them 'Press [|] to start recording 'Press [POWER] or [1] to end recording 'Press [1] to play recording 'RockAdo is moved to key [2] it can be included in remembered moves. '================================================================= 'Bambino-32 remember up to 7 sequences of key presses in RAM, ' forgotten on power off. ' Adjust RollC and PaceC added, easier to fine tune. '1664 bytes '----------------------------------------------------------------- Rationale: 'The RAM is divided into 8 slots which can be addressed by the 'number keys on the TVR010_PicAxe_IR_controller. 'ACTIVITIES: section completely rewritten for enhanced usage. 'Adjust RollC and PaceC added so they can be tested and fine tuned. '================================================================= 'Bambino-33 remember up to 8 sequence of key presses in EEPROM, ' now not forgotten. ' Data can now be sent to a PC. '1734 bytes '----------------------------------------------------------------- Rationale: 'It is not very useful to have to keep entering commands each time 'Bambino is turned on so now the commands are remembered in EEPROM. 'To see what values are in the Acts the EEPROM can be dumped to a PC 'in a format suitable for editing into a program for another Bambino. '================================================================= 'Bambino-34 obstacles memory made deeper for better obstacle avoidance, ' and put in RAM, Mfrus_obs introduced '1839 bytes '----------------------------------------------------------------- Rationale: 'In earlier programs the obstacle map was forgotten each time round 'the WANDER loop. 'In this program two RAM variables RAMobstaclesL and RAMobstaclesR 'remember obstacles from one loop to the next. 'Each time an obstacle is seen the relevant variable is incremented 'by 2, and each time round the loop both variables are decremented by 1. 'If obstacles are seen repeatedly then the memmory gets stronger and 'will last longer. When the memory reaches a certain level Bambino will 'turn with a backwards step. 'A limit is set as to how strong the memory can get '================================================================= 'Bambino-35 key [0] can now be learned '1846 bytes '----------------------------------------------------------------- Rationale: 'A learned Act can now include a jump to the WANDER routine. '================================================================= 'Bambino-36 incorporate drop-off avoidance from B25, ' remember holes and obstacles '1907 bytes '----------------------------------------------------------------- Rationale: 'Now we have figured out how to get Bambino to WANDER avoiding obstacles 'it is time to add looking for and remembering holes or edges. '================================================================= 'Bambino-37 PicAxe SRF05 Ultrasonic sensor added ' and facility to adjust ' USawareAt and UStoonear from IR-handset ' Adjust RollC PaceC removed to make room. '1883 bytes '----------------------------------------------------------------- Rationale: 'We have seen how the optical sensors can sometimes miss obstacles 'and holes so now it is time to use Bambino's Ultrasonic sensor. 'The sensor is triggered by sending a short pulse and measuring the 'length of a return pulse. 'There is a section PingSensors: which explains how distance is 'measured using sound. 'It is useful if Bambino ignores obstacles which are more than a 'certain distance away and reacts differently to obstacles which are 'too close. 'These distances can be set using the handset, see handset commands. '================================================================= 'Bambino-38 Added code to use either PicAxe SRF05 or an HC-SR04 ' Ultrasonic sensor with #defines for sensor type, ' cm or inches, and testUS. '1925 bytes '----------------------------------------------------------------- Rationale: 'While Bambino was designed to use an SRF05, a cheaper sensor, the 'HC-SR04 is available and can be used with Bambino. 'See the PingSensors: section below. '================================================================= 'Bambino-39 added CASE KEY_PLUS to Test Ping sensor and act on result, ' can be put in learned routines. '1898 bytes '----------------------------------------------------------------- Rationale: 'Being able to test the Ultrasonic sensor and act on the result while 'playing a recorded Act would be useful so this has been added. '================================================================= 'Bambino-40 minor rewrites - see modified, better use of R_Ping ' added poweron test of US, if <10 then disable US '1926 bytes '----------------------------------------------------------------- Rationale: 'minor rewrites - see modified, better use of R_Ping 'Also if the battery voltage gets low then sometimes the Ultrasonic 'sensor stops working and indicates an obstacle when there isn't one 'Bambino then keeps walking backwards away from the non existant object 'so a test has been put in INITIALISE: to disable the sensor if the initial 'reading on power-on is less than 10. '================================================================= 'Bambino-41 added CASE KEY_9 '[9] Behaviour to select behaviours ' B_slow,B_medium,B_fast, ' B_UStimid,B_USnormal,B_USbold, ' B_noWhiskers,B_noUS ' B_USxxx now write to RAM '1998 bytes '----------------------------------------------------------------- Rationale: 'Being able to have Bambino walk at different speeds and to react to 'obstacles at different distance adds to what it can do. 'Also if you think that the lights are affecting the optical sensors 'or low batery is affecting the Ultrasonic sensor then they can be 'disabled with KEY_9 mode. 'See the sections BambinoCommands: and TVR010_PicAxe_IR_controller:. 'Now the USdistances are in RAM any values saved using the handset are 'not overwritten when USbold, USnormal, or UStimid are used so if 'necessary the EEPROM is initialised with DUStoonear, DUSawareat, 'DUSconfigOK in INITIALISE:. '================================================================= 'Bambino-42 moved whisker testing and reaction to R_Whiskers ' added KEY_MINUS to test Whiskers and act on result ' removed test of US in INITIALISE:, not needed now on keys[9][8] '2009 bytes '----------------------------------------------------------------- Rationale: 'Just as it was possible to learn the command to test the Ultrasonic 'sensor and act on the result it is now possible to learn the command 'to test the optical sensors and act on the result. 'What happens after a test is coded in the section REACTIONS: '================================================================= 'Bambino-43 Act#8 made autorun ' On poweron to WANDER do [|][8][0][Power] ' command mode do [|][8][Power] ' WANDER B_slow do [|][8][9][1][0][Power] ' run Act1 do [|][8][1][Power] ' do SAct1 then Act1 do [|][8][^][1][1][Power] ' etc '2007 bytes '----------------------------------------------------------------- Rationale: 'To save room FdAdo: and BkAdo: deleted as not currently used. 'The initialisation of EEPROM USvalues has been removed. 'And DUSconfigOK=251 is no longer used. ' 'Previously Bambino always started to WANDER after power-on, now 'Act#8 autoruns and so you can get Bambino to do any Act or SAct 'and set the behaviours you want. '================================================================= 'Bambino-44 moved testing of DUSvalues and updating of RAMUS to B_USuser: ' [9][9] runs B_USuser: to get USuser distance values from EEPROM '2035 bytes '----------------------------------------------------------------- Rationale: 'Now [9][9] allows using USuser settings after other B_USxxx: behaviours '[9][9] runs B_USuser: empty EEPROM values set to B_USnormal '================================================================= 'Bambino-45 program now runs @32MHz except when pulsing Servos and Beeping ' Beeping didn't sound right @32MHz ' Servos pulsed @4MHz to keep 10us resolution which fits in a byte '2021 bytes '----------------------------------------------------------------- Rationale: 'Instead of having some ultrasonic timing at 4MHz for the SRF05 and 'other at 32MHz for the HC-SR04 everthing has been rewritten for '32MHz. 'All Pauses @32MHz are in units of 1/8ms, so pause 1 ms is PAUSE 8 'The servos are still pulsed at 4MHz because then the pulse value 'is in 10us units and so 0 to 2.5ms (0 - 250) fits in a byte. 'The SOUND command didn't sound right @32MHz and so is used @4MHz. 'One consequence is that the walking is much faster because the time 'between steps has been reduced by a factor of 8. '================================================================= 'Bambino-46 adjusment of sframe to fine adjust speed '2017 bytes, takes 38 seconds to download '----------------------------------------------------------------- Rationale: 'Some of the PicAxe20M2 chips run faster than others when set to 32MHz 'by maybe 10% to 15%. This caused Bambino #4 to fall over running RockADo 'B_faster:, B_normal:, B_slower: vitality Behaviour commands written 'to adjust sframe giving a finer speed adjustment than rollspeed and pacespeed. '================================================================= 'Bambino-47 [^][<]RollL and [^][>]RollR made, SERTXD("F") etc commented '2033 bytes '----------------------------------------------------------------- Rationale: 'RockADo decomposed into RollR and RollL for kicking a ball '=================================================================