Page 340 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 340

Amphibionics 07  3/24/03  9:13 AM  Page 319
                                                                                   PROGRAM 7.8
                        :1003800027088D000F308E008F01A120A4000D08DA
                        :0C039000A5000A306C2008006300CC2996
                                                                                   avoidance.hex file
                                                                                   listing (continued)
                        :02400E00F53F7C  Chapter 7 / Turtletron: Build Your Own Robotic Turtle
                        :00000001FF
                        Now that radio remote control and sonar obstacle avoidance has
                        been covered, a program will be written to incorporate both. An
                        operator will determine the robot movements, via the remote con-
                        trol. Based on distance measurements taken from the sonar mod-
                        ule,  the  microcontroller  will  inhibit  movement  if  the  robot  is  in
                        danger of crashing into an obstacle. Since the sonar is mounted to
                        the front of the robot, this will help protect the device. Compile the
                        program called remote-sonar.bas, listed in Program 7.9. Program
                        the PIC 16F84 with the corresponding remote-sonar.hex file, listed
                        in Program 7.10.
                        This kind of human/machine interaction is valuable in situations
                        where  a  robot  is  operated  over  large  distances  (teleoperated).
                        Because the complexity of machines has increased, it is impossi-
                        ble for humans to control all of the small aspects of robotic behav-
                        ior.  With  teleoperated  robotics,  the  human  gives  basic  control
                        commands  and  the  robot  carries  out  the  tasks  all  on  its  own.
                        Another problem with controlling machines over large distances,
                        because of slow radio signals, is that time delays are introduced
                        between the human control commands and the robot’s actions. If
                        a human operator makes a mistake, the robot will compensate to
                        avoid a catastrophic failure.


                        '------------------------------------------------------------------------------------------------------------------------------
                                                                                   PROGRAM 7.9
                        '  Name     : remote-sonar.bas
                                                                                   remote-sonar.bas
                        '  Compiler : PicBasic Pro - MicroEngineering Labs
                                                                                   program listing
                        '  Notes    : Remote control with sonar avoidance.
                        '------------------------------------------------------------------------------------------------------------------------------
                        ' PortA set as outputs. Pin 1 input.
                        trisa = %00000010

                                                                                                 319
   335   336   337   338   339   340   341   342   343   344   345