Submitted to the Journal on Computers and Education
Introducing Robotics at the Undergraduate Level† Sam R. Thangiah Sharad K. Joshi Artificial Intelligence and Robotics Laboratory Computer Science Department Slippery Rock University Slippery Rock PA 16057.
[email protected]
Abstract At the undergraduate level there is a need to expose students to the complexities of programming robots to accomplish real life tasks. This paper outlines how a course in robotics can be taught at the undergraduate level with specific experiments that allow for incremental learning in programming a mobile robot. The experiments can be conducted using either a commercially available robot or by simulating the actions of a robot. In addition, the minimum functional capabilities required of the robot to conduct the experiments and implementation of two experiments are described.
Introduction Many of the undergraduate classes in computer science deal with programming with respect to specific problems in which the environment under which they have to be tested remain static. That is, students learn to write programs to solve a problem with respect to a given set of data. Programming a mobile robot requires students to allow the mobile robot to perform autonomous navigation. Autonomous robot navigation deals with robots that interact with the real world with little or no human assistance. The robotics part of Artificial Intelligence is distinctive because of its need to interact with the real world. Most programs written at the undergraduate level depend heavily on the fact that the environment under which the program is to be run is well known. That †.This material is based upon work supported by the National Science Foundation under Grant No. USE-9250435. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.
1
Submitted to the Journal on Computers and Education is, programs are data dependent. Autonomous navigation has practical applications in problems found in navigation problems, autonomously guided vehicles, space explorations vehicle and remotely piloted vehicles for transport or reconnaissance. Robotics is entering the workplace of the future and it is of strategic importance that students are exposed to programming autonomous robots to do simple tasks[3][4][7][9][11]. One of the goals in navigating robots in a real world environment is constructing robust programs that have the capability to maneuver in complex environments. The robot, when moving autonomously in an unknown environment, must have the capability to sense the environment to avoid obstacles and in addition should always know its relative position with respect to the environment[1][6][8][14]. This goal has a number of inherent difficulties such as obstacle detection and avoidance and movement in complex environments.
In this paper, we present experiments in programming a mobile robot that allows for incremental learning. The experiments detail the objective, implementation and results of each project. The experiments address issues in obstacle detection, avoidance, and the movement scheme of programming a mobile robot. The paper is organized as follows. Section 2 gives a description of the B12 mobile robot that was used for the experiments. Section 3 gives the functional capabilities of the mobile robot required for conducting the experiments. Section 4 and 5 give a detailed explanation of the experiments and the implementation details of two experiments using the C language. Section 6 is the summary and conclusion.
The B12 Mobile Robot The experiments in programming a mobile robot was done using the commercially available B12 mobile robot. The B12 model was developed in 1988 by Real World Interface, Inc. with cooperation from the Mobile Robot Group at the Massachusetts Institute of Technology Artificial Intelligence Laboratory[2]. The B12 has three wheels, rigid suspension, synchronous drive, a 40 pound carrying capacity, and a 144 watt hours of battery power. It has omnidirectional capability as all the three wheels are driven synchronously and remain parallel at all times. The B12 has high
2
Submitted to the Journal on Computers and Education positional accuracy due to the separation of the steering system from the drive system. It also has good traction as all wheels are driven. The B12 robot consists of 12 Polaroid sonar units. The diameter of each sonar unit is about 1.5 inches and the center of each sonar unit is mounted 12 inches away from the ground.
There are two main units in the B12 mobile robot, namely the base unit[2][12] and the sonar unit[5]. The base unit is for doing the rotational and translational movements of the robot and is controlled by a NEC 78310 microprocessor. The base unit is controlled using a set of predefined control commands. The set of control commands available on the robot allow varied number of operations to be performed in terms of operating the robot. The robot consists of 12 Polaroid sonar sensors that are mounted on the sides of the mobile robot and is controlled by a Motorola 68HC11 microcontroller. Twelve polaroid sonar units are mounted around the upper portion of the robot with each sonar having an individual driver and individual address. The third processor, the Motorola 68000 processor, acts as the master processor that controls the sonar unit and the base unit.
The B12 mobile robot base unit has a set of primitive base commands that allows for the control of the robot. In order to write programs to control the robot, the primitive base commands for the robot have to be incorporated into a language that allows looping and conditional checks. Initial experiments using the B12 mobile robot were conducted by writing the instructions to control the robot in Motorola 68000 Assembler language and using a 68000 Assembler to cross-compile the code for the Motorola 68000 microprocessor[2]. The machine code generated by the cross-compiler are uploaded to the Motorola 68000 microprocessor in the B12 mobile robot. and executed.
Commands for the Mobile Robot In order to allow undergraduate students to program the mobile robot without knowledge of the
3
Submitted to the Journal on Computers and Education Motorola 68000 assembly language, an interface to control the robot using C language was developed. The interface in C language to control the robot consists of C language commands and in-line Motorola 68000 Assembly language instructions. This interface in C language allows the students to program the B12 mobile robot using standard C language, reducing the time required to program the robot by about 60% compared to programming it in Assembly language [13]. This section explains the procedures that are present in the C language interface for controlling the B12 mobile robot. The procedures used in programming the B12 mobile robot are as follows:
• Get_Base_XY() The B12 mobile robot is capable of deadreckoning, or keeping track of its X and Y coordinates when moving around the environment. The X and Y coordinates of the robot are placed in global variables defined as Base_X and Base_Y. This procedure updates the global variables Base_X and Base_Y to the current position of the robot.
• Wait_TBase_Stop() The Motorola 68000 processor is the master processor that controls the base of the robot and the sonars. When a command is sent to the base of the robot it can execute it independently of the commands for the sonars. This results in situations in which the robot is moving while the environment is being scanned by the sonar, resulting in false readings by the sonar. In order to prevent false readings by the sonars, the robot must be at a standstill before the sonars scan the environment. This procedure sends a command to the base and waits until that command has terminated executing before executing the next command.
• Find_Rotate_Index() The B12 mobile robot consists of an alignment sensor that allows the wheels and the sonars to be aligned before performing any experiments with the robot.
• Set_Rotate_Accel(int i) The rotational acceleration of the robot is set using this procedure. The parameter i is the rotation acceleration value for the robot. The rotation acceleration is the number of revolutions per
4
Submitted to the Journal on Computers and Education second squared.
• Set_Rotate_Velo(int i) The rotational velocity of the robot is set using this procedure. The parameter i is the rotational velocity value for the robot. The rotational velocity is the number of revolutions per second.
• Set_Translate_Accel(int i) The translational acceleration of the robot is set using this procedure. The parameter i is the translational acceleration value for the robot. The translational acceleration is in number of centimeters per second squared.
• Set_Translate_Velo(int i) The translational velocity of the robot is set using this procedure. The parameter i is the translational velocity value for the robot. The translational velocity is in number of centimeters per second.
• Kill_B12() This procedure kills the translation and rotation motors in the robot.
• Rotate_Clock(int i) This procedure is used to rotate the robot in a clockwise direction by i degrees. The command Rotate_Clock(30), rotates the robot by 300 relative to the current position of the robot in a clockwise direction using the programmed rotational velocity and acceleration.
• Rotate_AntiClock(int i) This procedure is used to rotate the robot in an anti-clockwise direction by i degrees. The command Rotate_AntiClock(30), rotates the robot by 300 relative to the current position of the robot in an anti-clockwise direction using the programmed rotational velocity and acceleration.
• Move_Forward(int i) This procedure moves the robot forward by i centimeters from the current position. The
5
Submitted to the Journal on Computers and Education command Move_Forward(10) moves the robot forward by 10 centimeters.
• Move_Back(int i) This procedure moves the robot back by i centimeters from the current position. The command Move_Back(10) moves the robot back by 10 centimeters.
• Ping_Sonars() This procedure is used to read in the sonar values from the 12 sonar units present in the robot. This procedures reads in the values retrieved by the sonar units and places them in the global array variable named Sonar, which consists of twelve array locations. In order to access the value returned by the first sonar unit, one would access the array location Sonar[0].
• Delay(int i) This procedure is used to delay the Motorola 68000 processor by i seconds before executing the next command. The command Delay(3) will delay execution of the next command by 3 seconds.
• Rotate_Halt() This procedure decelerates and stops the rotation motor.
• Translate_Halt() This procedure decelerates and stops the translation motor.
The following commands allow the student to write programs to control the robot. The projects should allow for the incremental learning of the controlling the robot. The following projects were conducted in an undergraduate class and allow for incremental learning.
Experiments in Programming the B12 Mobile Robot The undergraduate course in robotics should consist of two classroom lectures and one laboratory session a week. The classroom lecture will cover the theory of symbolic and sub-symbolic artificial intelligence methods. The laboratory sessions will cover the use of the mobile robot and
6
Submitted to the Journal on Computers and Education its sonar sensors. This course will integrate the theory of symbolic and sub-symbolic artificial intelligence methods with practical methods for solving real world problems. The artificial intelligence methods will be experimented using the B12 mobile robot that interacts in a noisy environment. The specific experiments conducted for the course are explained with the objective, implementation and results of the implementation.
Experiment 1: Motion Detection in an Environment Objective: Polling for sensor information from the sonars to detect motion in the robot’s environment. Implementation: The robot will be placed in a stationery location in the environment to poll for sensory information received from the sonars. Initially, for a short period of time, the robot will acquaint itself with the surrounding environment. After this period of time, sensory information received from the sonars will be compared against known information of the surrounding environment. If the current information is different from the known information, a movement in the environment is detected. Results: This experiment acquaints students with the retrieval of sensory information from the sonars.
Experiment 2: Autonomous Navigation of Robot Objective: The robot is to move around the room without bumping into any walls. Implementation: The robot will move around the room without bumping into any obstacles. The sensory information from the sonars will indicate the presence or absence of obstacles. Results: This experiment will teach students to coordinate the movement of the robot based upon sensory information received from the sonars.
7
Submitted to the Journal on Computers and Education Experiment 3: Room Perimeter Mapping Objective: The robot will travel autonomously around the room and map the perimeter of the room Implementation: The robot will begin at an initial position of an enclosed room and travel along the perimeter of the room avoiding obstacles and return back to the initial position.Each directional movement of the robot will be recorded during the movement from the initial position to the final position. After the first tour of the room, the robot will travel at a higher speed around the perimeter of the room with the sonars turned off. Results: This experiment will teach the methods required in coordinating the sensory information received from the sonars, control of velocity and acceleration of the robot and the recording of the movements.
Experiment 4:Trajectory Planning with the mobile robot Objective: The robot is to move from an initial location to a target location in the environment while avoiding obstacles. Implementation: The robot will begin at an initial location of the room and move towards a target location of the room while avoiding obstacles. The movement from the initial location to the target location is achieved by transforming the room into a two dimensional grid with the robot at grid location (x1,y1) and moving towards grid location (x2,y2).The movements will be in intervals of n units in any of the eight directions to allow easy calculation of grid coordinates. Results: The student will learn about trajectory planning and responding locally to obstacles while globally moving towards the target.
As the C language interface supports the basic commands to control the robot, standard C code can be integrated with these commands to perform complex tasks. The C language interface is being extended to support some of the other base commands available for the B12 mobile robot such as torque and bump detection. The experiments in programming the B12 mobile robot can
8
Submitted to the Journal on Computers and Education also simulated within a controlled environment as detailed in [10]. The simulation procedures will use the procedures that were defined in Section 3 and apply them with respect to the environment being simulated.
Programming the Robot using the C Language The C language interface was used to implement a number of projects. In this section we give examples of using the C language interface to implement two different projects. The first experiment was for the robot to scan the environment and compare the previous reading of the sonars with the current sonar readings to detect any change in the environment between the readings. If there is a change in the readings, then the robot assumes that the environment has changed and moves forward and backwards. If there is no change in the environment, the robot rotates clockwise and anti-clockwise. The flow of the algorithm is described in Figure 1. The C language implementation using the interface is described in Figure 2.
Step 1: Initialize the robot. Step 2: Ping the sonars and place the values in the array Sonar. Set changeFlag=0. Step 3: Copy the contents of the array Sonar into the array currentEnv. Step 4: Ping the sonars and place the values in the array Sonar. Step 5: Check each of the array elements in the Sonar array against each of the elements in the currentEnv array. If any of the elements in the Sonar array differ by 15 units from the corresponding element in the currentEnv array then Set changeFlag = 0. Step 6: if changeFlag = 0 then Move the robot forward by and backward by 10 centimeters, Copy the contents of the array Sonar into the array currentEnv array, Set changeFlag=0. else Rotate the robot clockwise and anti-clockwise by 900. Go to step 4
Figure 1. The flow of the algorithm for detecting a change in the environment
9
Submitted to the Journal on Computers and Education main() { extern short Sonar[]; short currentEnv[]; int changeFlag; int i,j,
/* array variable holding the sonar values */ /* array to store sonar values temporarily */ /* counter variables */
Find_Rotate_Index(); /* set the robot to the initial starting position*/ Set_Rotate_Accel(1); /* set accel to 1 rev. per second sq. */ Set_Rotate_Velo(1); Ping_Sonars(); /* read current sonar variables*/ copyCurrentEnv(); /* store sonar values in temporary array */ while (1) /*keep scanning the environment*/ { Ping_Sonars(); /* read in the sonar values changeFlag=0; /*changeFlag=0 means no change in environment */ /* check current readings with previous readings. If there is a difference in the readings*/ /* by 15 centimeters, set the changeFlag. 15 centimeters is the error tolerance for sonar readings*/ for (j=0; j 15) { moveUnit = i - 15; Move_Forward(moveUnit); else Rotate_Clock(90); } } /* End of Main */
int getFrontValue() /* get the minimum values of the front sonars. The front sonar for the B12 mobile robot are*/ /* sonar 0, 1 and 2 */ { int minValue; minValue=Sonar[0]; if minValue > Sonar[1]; minValue= Sonar[1]; if minValue > Sonar[2]; minValue= Sonar[2]; return(minValue); }
Figure 4. The program using the C language interface to move the robot around in an environment without bumping into obstacles.
11
Submitted to the Journal on Computers and Education The second experiment was to move the robot around the environment without bumping into any obstacles. In this experiment the sonar readings are used to determine the distance an obstacle is away from the robot. If the movement of the robot will cause it to bump into an obstacle, then the robot will turn away from the obstacle and head in an open direction. The flow of the algorithm is described in Figure 3.The C language implementation using the interface is described in Figure 4.
The two projects described above were implemented with and without the C language interface. The projects without the C language interface were implemented by students in a previous class using only the Motorola 68000 Assembly language[6]. The number of Motorola Assembly language code required to do the task was 380 and 600 lines respectively and took about 5 weeks for completion. The same project when implemented using the C language interface required about 50 lines of C language code and was completed in a couple of days as the students only needed to know how to use the interface.
Summary and Conclusions In this paper we describe how a course in robotics can be taught at the undergraduate level using the B12 mobile robot. We outline the minimal capabilities of the robot required to teach a course in programming a mobile robot by means of a C language interface program that does not require the student to have knowledge of Assembly language. We also outline experiments that can be conducted using the C language interface for programming a mobile robot and describe two experiments implemented using the C language. The procedures used in controlling the robot can be implemented without the B12 mobile robot using a simulated environment.
12
Submitted to the Journal on Computers and Education References [1] Arkin, Ronald C. (1990). Integrating Behavioral, Perceptual and World Knowledge in Reactive Navigation. Robotics and Autonomous Systems, 6, 105-122. [2] B12 Mobile Robot Base Guide to Operations (1992). Version 2.1, Real World Interface, Inc., New Hampshire. [3] Linnell, Charles C. (1993). Robotics Education and Employment. The Technology Teacher, 53, November, 7-11. [4] DeVault, M. Vere, Kenneth Rouiller and Dean Siewert (1986). Robotics and the Curriculam: Addressing the Questions. Curriculam Review, 25, April 1986, 34-34. [5] G96 Sonar Board Guide to Operations (1992). Version 1.1, Real World Interface, Inc., New Hampshire. [6] Jorgensen, Charles, William Hamel and Chrles Weisbin (1986). Autonomous Robot Navigation. Byte, January, 223-235. [7] Klein, George (1986). Robotics Projects Made Simple. Industrial Education, 75, May, 10-11. [8] Krogh, Bruce H. and Charles E. Thrope (1986). Integrated Path Planning and Dynamic Steering Control for Autonomous Vehicles. Proceedings of the IEEE International Conference on Robotics and Automation, Washington D.C., 1664-1669. [9] Oakes, Merril M. and Richards Harold (1988). Robotics in the Technology Education. Technology Teacher, 48, November 1988. [10] Pape, Claude Le (1990). Simulating Actions of Autonomous Agents. Technical Report 38, Robotics Laboratory, Department of Computer Science, Stanford University, Stanford, CA. [11] Regh, James A. (1985). Robotics Programs: Automation training in Disguise. Industrial Education, 74, May-June, 17-19. [12] Real World Interface B12 Base Control Software (1993). Version 073093 New or Undocumented Features, Real World Interface, Inc., New Hampshire. [13] Thangiah, Sam R. Sharad W. Joshi and Tong Sun (1994). An Interface in C Language for the B12 Mobile Robot. Proceedings of the American Society for Engineering Education, Edmonton, Canada,1666-1674. [14] Vasseur, Hubert A., Francois G. Pin and Jack R. Taylor (1992). Navigation of Car-Like Mobile Robots in Obstructed Environments using Convex Polygonal Cells. Robotics and Autonomous Systems, 10, 133-146.
13