Johns Hopkins University What is Engineering? M. Karweit ROBOTICS Robotics is the technology of robots. What is a robot? From the Robot Institute of America, "a robot is a reprogrammable, multifunctional manipulator designed to move material, parts, tools, or specialized devices through variable programmed motions for the performance of a variety of tasks." And, from those who must deal with the present capabilities of robots, " a robot is a one-armed, blind idiot with limited memory and which cannot speak, see, or hear." Whatever the definition, it doesn't take a lot of imagination to realize that the potential for more sophisticated robots is enormous. In some cases, the potential is primarily economic, e.g., using robots on automotive assembly lines to reduce labor costs. In other cases, the potential exists in performing tasks that are not humanly possible, e.g., carrying out activities in hostile environments--the ocean floor, areas of high-level nuclear contamination. And then there’s the potential for medical applications—the possibility surgery through three small holes rather than a 40cm long slit; or heart repair on a beating, functioning heart; or an operation performed by a specialist surgeon 1000 km away. These are the challenges for robotics engineers. "Reprogrammable, multifunctional" are the operational words. There are many automated machines which are designed to carry out single tasks. But that's all that they can do. Candydispensing machines, toasters, CD-changers are examples. And these automated machines can be very efficient because they can be optimally designed to perform their single task. The idea of a robot is that it can be reconfigured to perform different tasks. As a result, they tend to be much less efficient than automated machines. Computers and robots are quite similar. They are both programmable and can be configured to carry out a variety of tasks. The difference between the two, however, lies in what kinds of tasks can be handled. Computers can carry out only mathematical operations. True, they can be interfaced with other physical devices, but then they become controllers (perhaps for robots). Robots, on the other hand, carry out tasks on tangible things: " materials, parts, tools, specialized devices. . ." Dealing with tangible things as opposed to abstract things (such as mathematical operations) makes the robot a far more complicated device. Actually robots and computers have a common heritage--a programmable loom. The idea came in 1801 from Joseph Jacquard, a stone mason from Lyon, France. The Jacquard loom was a device whose weave pattern was determined by a sequence of perforated cards. A single machine could produce a wide variety of textile weaves simply by punching holes in cards and properly sequencing them. One card at a time, the loom would detect the hole configuration, and appropriately raise or lower the warp threads to generate the textile pattern. So the idea of a programmable machine is almost 200 years old. The concept of a robot, however, is much newer. "Robot" was first used in a Czech play which opened in London in 1921. The word comes from the Czech robota which means serf or one of subservient labor. 1 Johns Hopkins University What is Engineering? M. Karweit II Robot characteristics What types of robots are there? It’s useful to classify robots in terms of the type of task that they’re designed to perform. Recall, that a robot is reprogrammable, so that, with some sort of reconfiguring, it should be able to carry out a range of similar tasks. In fact it is useful to group robots in terms of the tasks they can perform: 1) “pick and place”, e.g., moving a piece from a conveyor belt into a box. 2) continuous path control, e.g., welding a seam along the edges of adjacent pieces of steel 3) sensory—capable of 1) or 2), but with the added feature of being able to “feel” the piece on the conveyor belt or sense the track of the desired weld path or feel the resistance of the material. Basically “pick and place” means carrying out an action at location A, moving to B, carrying out another action at B. The route for getting from A to B is unimportant. This is the simplest type of robot. All you have to do is figure out mechanisms to perform the actions at A and B, then pick from a variety of mechanisms to get from A to B. Don’t misunderstand. These robots are not so easy to design. The real question is just how flexible do you want the robot to be? Would you want the same robot to be able to place eggs in crates from a conveyor belt and also move automobile engines from a test stand to an assembly line? The more flexible, the less efficient. But a different robot for each slightly different task is costly. Where’s the tradeoff? It’s an engineering question. “Continuous path control” can be much more complicated. These robots must exhibit continuous, precise control of its actuator(s) as they move along their specified path from A to B. Both the path and the speed along the path can be important. Robotic welders obviously must follow the intersection of the pieces it is trying to join, but it must also travel at a constant rate to produce a uniform weld joint. We will see later the problems that this requirement poses. Tasks can be performed in one of two ways: “open loop”, i.e., no feedback, deterministic; or “closed loop”--with feedback control. Robots can be designed for “Pick and place” and “continuous control” tasks as open loop. An example of this might be picking up a bottle on a conveyor belt. But if a bottle is too far away from where it is supposed to be, a robotic arm will miss the bottle. To address that problem, we could design the robot to have some sort of “vision” or mechanical sensor to detect where the bottle actually is. Then, we can use that position information to define the action of the robotic arm. Such a system would be "closed loop", because the motion of the arm is being determined by the bottle's position. The arm "senses" where the bottle is. Sensory control is yet another level of complication in robots. In some cases the control can be simple, e.g., reflection-actuated direction control which allows a robot to follow a yellow line on the floor. Here, for example, three light sensors might detect the reflectivity of the line on the floor. If the middle sensor “sees” the line, the robot is on the right track. If the left sensor detects the line, then the robot is too far to the right. So how do you use this information in programming a robot to follow the line? One way would be to link the sensor output to a steering device—turn left, go straight, turn right. But how much left or right? The robot could oscillate 2 Johns Hopkins University What is Engineering? M. Karweit rather wildly along the line. What might you build in to a control system to prevent this from happening? Sophistication in handling the sensor output? Maybe a different sensor system altogether? Think about this. There’s always two issues: What is the sensory signal you will use? What will you do with the signal? [If you’re going to be a good scientist or engineer, always ask questions: How could such a task be accomplished? Is there a better way of performing the task? Is there a different technology that might be better suited for the task? Then, of course try to answer them. Just like a pianist, the more you practice your art, the better you can become. Over time your questions will become more insightful, your solutions more elegant. ] As computers become more powerful, more robots will probably be using television cameras as sensory devices. In these cases, the real sensing consists of image processing—the extraction of information from images. Image processing can be used to determine, for example, the orientation of a part on an conveyor belt, so that the grasping mechanism can be properly rotated to pick the piece up. Or it can detect the beginning and end of a seam to be welded. But all this must be done in real time. Edge detection, pattern recognition, and image enhancement are techniques of image processing. Not all robots are entirely preprogrammed to run autonomously. Some are designed to be controlled by a person, e.g., a robotic surgical scalpel. Let’s look at some of the issues pertaining to such a device. First, the system must provide a sense of “touch” to the operator. How hard is the scalpel being pushed against the tissue? The classical example is whether a system could allow an operator to “feel” when a scalpel passing through jello would detect the presence of a grape. Jello and grapes have consistencies not too different from living tissues. Second, the system might provide error correction. In long operations, a surgeon’s hand might begin to tremble. If that surgeon were operating via a robotic scalpel, the system could cancel out those tremors for far steadier procedures. Third, the system must provide instant feedback. A surgeon/operator needs to know the scalpel’s position and resistance to motion as it is moved, not later. Robotic surgery exists today when the surgeon/operator is in the same room as the patient. But it does not exist today when the surgeon/operator is performing from some remote site. Why? Because transmission delays interrupt that instantaneous feel of the scalpel. (Incidentally, the study and development of machines with senses of touch and kinesthesia is called haptics.) III. Measures of performance Robots move. Some are stationary and move only their appendages; others are mobile and, in addition to moving their arms, move from place to place. How well they move is extremely important, because how well they move determines what they're good for. We can identify a number of characteristics that affect performance. First, there is the working volume, the space within which the robot operates. Since a robot is built with mechanical linkages, there is almost always a spatial limit to its tasks. Usually the bigger the volume, the better, because a larger working volume would suggest that a wider variety of tasks might be performed. But there is a tradeoff. Mobile robots obviously will have a larger spatial range than stationary robots, but their control is much more difficult and expensive. 3 Johns Hopkins University What is Engineering? M. Karweit Second, we might ask how quickly can the robot perform a task, i.e., what is the speed and acceleration of its actuators. Can it move 20 objects per minute or 200 objects per minute? Sometimes speed is not an issue. For example, in robotic welding, the rate at which a seam can be welded is usually not limited by the speed of the robot, but rather the speed at which a good joint can be made. But, for other things, like testing the pins on a 186-pin microprocessor chip, speed is money. Third, repeatability. Will the mechanism always return to the same point under the same control conditions? This is not just an issue with robots. Almost anything mechanical has some "slop" in its system. An experimenter always "dials in" a value with a knob on an instrument from the same direction, say, on a high-precision potentiometer. This is because there is often a little play between the indicator on the knob and its action. In robots, the problem is usually worse, because there is typically a sequence of links, each having play. Further, loads may affect repeatability. That is, a fixed control condition may produce different positions depending on the load. This is a tough problem because it may also depend on an arm's orientation. Then there is resolution. What is the smallest "step" the robot can take? Suppose we have a single-arm robot whose arm tip position is set by a stepper motor which can be programmed in one-degree increments. If the arm is 1 meter long, the resolution will be no better than 1.7 cm. Is that good enough? It depends on the application. What if I told you I wanted to remove your appendix with a robotic scalpel whose resolution was 1.7cm? Finally, we can list accuracy. Accuracy is the difference between the actual position of the robot (or arm) and the programmed position. A robot might be accurate, but not repeatable-i.e., over a series of attempts at reaching the desired position, the robot would, on average, cluster around the target, but have substantial positional error on each attempt. Or a robot might be inaccurate, but reapeatable--it would constantly miss the target, but its attempts would cluster tightly together at some other location. These five attributes of robotic behavior are issues for all robots. They are affected by design, by materials, by loads, by construction quality. But these are the details of how robots are put together. How can we specify the positions--from one link to the next? Here we must turn to kinematics and dynamics. III Kinematics and dynamics Kinematics is the physics of motion. It's prescribes what mechanically goes on. But it is not concerned with forces or momentum. That's the realm of dynamics. Dynamics is the more difficult subject. We'll touch on dynamics a little later, but for now we'll focus on kinematics. Robots have varying abilities to move. Some might only be able to extend or retract. Others are able to move in any direction and simultaneous rotate its actuator arm. What we're specifying here are degrees of freedom--the number of independent motions a robot can make. 4 Johns Hopkins University What is Engineering? M. Karweit There are two sets of motions: translation and rotation. Translation is motion from point A to point B. It can take place in one, two, or three dimensions. Rotation is motion at a fixed point. Again, it can take place with respect to one, two, or three independent axes. Between the two types of motion--translation and rotation--all motions can be accounted for. Full threedimensional motion requires 6 degrees of freedom--3 translation, 3 rotation. A robotic arm that could only extend or contract and, say, twist its actuator on the axis of the arm would have only two degrees of freedom--1 translation, 1 rotation. More degrees of freedom implies more versatility and larger working volume. However more degrees of freedom, also implies higher costs, less accuracy, lower repeatability. Consequently, robots are usually designed having the fewest number of degrees of freedom to do the job. Robots are usually constructed of rigid members, whose motions with respect to one another are afforded through the joints that hold them together. It is the properties of these joints that the give robots the mechanical maneuverability. Basically, there are only two types of joints: prismatic and revolute. Prismatic joints slide, e.g., a square cylinder in a square tube. Revolute joints or hinge joints rotate. So revolute joints allow angles between members to change. OK, but what about ball-and-socket joints? Well, a ball-and-socket joint can be thought of as three hinge joints. A ball-and-socket joint has three degrees of freedom in rotation. So its action can be duplicated by the combined action of three hinge joints. A cylindrical shaft in a cylindrical tube can rotate and extend. It's easy to see that this action could be replicated with one prismatic joint and one hinge joint. One can construct a variety of mechanical joints. We've mentioned a few--ball-andsocket, cylindrical shaft in cylindrical shaft. But the motions of all joints can always be reduced to a combination of the two basic types: prismatic and revolute. The reason we want to reduce their actions to combinations of the primitive types is so we can mathematically describe them more easily. We'll see this a little later. We've mentioned the actions of mechanical joints. That's motion within the robot. Let's not forget the motion of the robot itself. Again, whether the robot turns on an axis, moves on wheels, or swims through water, the actions can be reduced to the primitive forms. Now that we've touched on the conceptual ideas of robots, we must turn to the messy stuff--the mathematics that describes their actions. We won't delve too deeply into this topic because the mathematics can get very complicated very quickly. But we can develop some methods for prescribing the positions of the actuator with respect to the position of the base of the robot. Here, the mathematics is not very difficult; but it can be cumbersome because there are many different ways we might want to represent position. What coordinate system(s) should we use. There are many to choose from. The most familiar is the "cartesian" system (x,y,z) in which position is specified by the three distances x,y,z from the origin. But we could also consider a cylindrical system (r,,z)--consisting of two distances and one angle, or a spherical system (r,,) consisting of one distance and two angles. Our decision will depend, in part, on the frame of reference in which the task or object can most easily be represented, and, in part, on the frame of reference in which the mechanical actions of 5 Johns Hopkins University What is Engineering? M. Karweit the robot are most conveniently represented. A robot consisting of a fixed base and an extensible arm that can be rotated in a horizontal plane, would most naturally described by an (r,,z) system. We say most natural because the choice of the coordinate system reflects the action of the robot: one action is spatial, the other is angular. Now suppose, at the end of this robotic arm, there is a tool which moves in and out, up and down, and back and forth, i.e., three spatial actions. Here, most naturally we would use an (x,y,z) system. So, we might want an (r,,z) for the arm, an (x,y,z) system for the tool tip, and maybe another (x,y,z) system to describe the actuator position in "world" coordinates. So, several different frames of reference might be useful. To specify absolute position of the tool tip, its position with respect to the arm must be added to the position of the arm. How do we bolt all of this together? Here is a schematic of the situation. There are three coordinate systems: (x,y,z), (r',',z'), and (x'',y'',z''). The robot is presented here as three heavy lines; the tool is represented as a ball. The positions of the robot base, the robot arm, and the tool are given in italics. z'' z' z y (x'',y'',z'') x' ' (r',',z') ' x (x,y,0) r' We want to prescribe the position of the tool in the world coordinate system (x,y,z). It's not so simple. Basically we have to get from one coordinate system to the next. This is accomplished through the operation of coordinate transformation. Basically there are two things you can do with coordinate systems: you can translate them, and you can rotate them. If you look at our robot example, you will see that the x'' system (the reference frame of the actuator) is a translation of the x' system (the reference frame of the arm). And the x' system is a translation and rotation of the x system (the world reference frame). For a moment, let's simplify a bit. In two dimensions, if we want to relate a position x', y' in a coordinate system x' to a system x , where the x' system is rotated with respect to the x system through an angle , we can write down the equations as 6 Johns Hopkins University What is Engineering? M. Karweit x = x' cos - y' sin y = x' sin + y' cos cos sin x' x . (See the appendix on matrix algebra.) In matrix form, this would be sin cos y ' y The 2 x 2 matrix is called the rotation matrix. This set of equations can also be represented as R x' = x. So, this equation describes a rotation transformation. What about a coordinate translation? If k is the vector representing the translation of a coordinate system x, then x' = x k. If there's both rotation and translation, then we can combine the coordinate transformations into a single equation as x = R x' - k. Of course, we can also extend these ideas to three dimensions. We've implemented rotation and translation above as two separate--and different-operations: a matrix multiplication and a vector addition(subtraction). It turns out we can combine these two operations into a single homogeneous coordinate transformation. Consider the following matrix equation. x e11 e21 e31 k x x' y e12 e22 e32 k y y ' x = H x' . z e e23 e33 k z z ' 13 1 0 1 0 0 1 H is called the homogeneous transformation matrix and can be viewed as having four k R . R is a 3 x 3 rotation matrix; k is a 3 x 1 translation vector. So, H can be parts: H = 0 0 0 1 used for any coordinate transformation because it encompasses rotations, translations, and combinations of the two. D. Transformations 1) General coordinate transformation from x’ to x is x = Bx’ + p , where B is a rotation matrix and p is a translation vector 7 Johns Hopkins University What is Engineering? M. Karweit B p 2) More conveniently, one can create an augmented matrix A 000 1 which allows the above equation to be expressed as x = A x’. 3) Coordinate transformations of multilink systems are represented as x0 = A01 A12A23. . .A(n-1)(n)xn E. Dynamics 1) Velocity, acceleration of end actuator a) power transmission b) actuator i) solenoid –two positions , e.g., in, out ii) motor+gears, belts, screws, levers—continuum of positions iii) stepper motor—range of positions in discrete increments Example of a 2D robotic link having three solenoids to determine geometry. All members are linked by pin joints; members A,B,C have two states—in, out—controlled by in-line solenoids. Note that the geometry of such a link can be represented in terms of three binary digits corresponding to the states of A,B,C, e.g., 010 represents A,C in, B out. Links can be chained together and controlled by sets of three bit codes. A B C A B C A B C A A B B A C C A A B B B C C C 8 Johns Hopkins University What is Engineering? M. Karweit 2) Problems a) joint play, compounded through N joints b) accelerating masses produce vibration, elastic deformations in links c) torques, stresses transmitted depending on end actuator loads IV Control and programming 1) Position of end actuator a) multiple solutions 2) Trajectory of end actuator—how to get end actuator from point A to B a) programming for coordinated motion of each link b) problem—sometimes no closed-form solution Let's explore what would seem to be a really simple robotics problem. Suppose we have a two-segment robotic arm that is attached to a base and that can move in only two dimensions, x and y. Each arm segment is the same length, L1 = L2 ; and the motion of each arm segment is determined by a stepper motor that can position the arm at any prescribed angle. The problem is to program the two stepper motors so that the robot arm tip, i.e., the end of L2 , follows a path at y = const. L2 y 2 L1 1 Two-segment robotic arm 9 Johns Hopkins University What is Engineering? M. Karweit We'll assume that each stepper motor can be controlled as (t ) 0 t t 2 where 0 is the angular position at the beginning, and and are parameters to establish the angular velocity and acceleration over time. And a programming segment will constitute time t moving from 0 to 1. So, by setting values for 0, , and for each motor, the time-behavior of the arm tip can be generated one program segment at a time. The geometry is easy: assuming that the base of the robotic arm is fixed at (0,0), the position of the arm tip is x = L1 (cos 1 + cos 2) y = L1 (sin 1 + sin 2) If we want the arm tip to move, we must rotate the stepper motors which prescribe the angles 1 and 2. As 1 and 2 change, so does the position of the arm tip. In fact, using the chain rule of elementary calculus we can deduce the relationship between the rates of change of x and y and d the rates of change of 1 and 2. Using a dot above a variable to denote , we calculate that dt x L1 sin 1 1 sin 2 2 y L1 cos1 1 cos 2 2 0 . Setting the latter equation equal to zero gives us the condition that the y-position of the arm tip does not change, i.e., y = constant. These equations give the simple result: cos1 . This says that the rate of change of 2 is proportional to the rate of change of 1, cos 2 but the rate of proportionality depends on the values of 1 and 2. In fact, as simple as this robotics problem is, there is no closed-form solution. That is, we cannot produce an explicit recipe which will ensure that, as 1 changes, 2 will change in such a way that the y-position of the arm tip is constant. 2 1 Since there is no mathematical solution, we must try to find an engineering solution—an approximation. And within this approximation we will have to accept some minor variations in y. Further, we might not be able to find even an approximate solution that will work throughout the entire range of motion of the arm. So, moving the arm tip through its maximum range of x might have to be accomplished through a sequence of program steps that define different rates of changing 1 and 2. Recall, that each motor can be programmed to rotate as (t ) 0 t t 2 ,. These parameters are all we have to work with to make the arm move correctly. To get a visual feel for how an arm tip moves as a function of the angular speeds of stepper motors, investigate the 10 Johns Hopkins University What is Engineering? M. Karweit robotic arm simulation at http:\\www.jhu.edu\virtlab\robot.htm. Use the simulation to try out the strategies outlined below. Assuming that the arm tip is initially at the desired value of y, what strategies can one use to move the tip along x, say in the interval from xbegin to xend, while keeping y = const.? There are three straightforward ones. The simplest approach is to calculate the rates of change of 1 and 2 for y = const. for the initial values of 1 and 2 , i.e., determine values for a1 and a2 (here, the subscripts refer to the cos( 01 ) motors) such that 1 and 1 = 2 = 0. This will ensure that the arm tip will least start 2 cos( 0 2 ) along a trajectory of y = const. If , over time, the arm tip exceeds some allowable y, reprogram the (t) equation for another step using the final values of 1 and 2 from the previous step as initial values for the next step. A few trials with the robotic arm simulator will demonstrate that this technique isn’t very good. The principal problem is that 1(t) and 2(t) will produce y(t) = const. only at the beginning of the interval over which the arm tip is to move. The farther the arm tip moves away from this initial position, the farther the tip will deviate from its initial y-position. In other words, the condition for y = const. is established for the beginning of the interval but is hoped to hold for the entire interval. dy 0 , not just at the beginning of dt the interval, but rather as an average over the whole interval. In this case, the arm tip would begin to move with y const. But as the tip moved farther into the interval, things would get better, not worse—as in the first case. To produce this case we need only to program the rates of change of 1 and 2, i.e., 1 and 2, so that the arm tip at the end of the time period would be at the desired end point. A better solution might be to consider the condition for That is, we don’t need to make an explicit calculation for dy 0 . If the arm tip begins dt dy 0 on average must be met. Here, the dt hope again is that the arm tip will remain within some allowable error y. Again, try this technique with the robotic arm simulation. You should find it to be a significant improvement over the first method. But it still may not allow you to traverse the tip from one extreme value of x to the other. and ends at the same value of y, then the condition of What we really need are forms for 1(t) and 2(t) that will take into account the changing condition for y = const. as the arm tip moves. To do this, we must first get an idea of how that condition changes with x. So, let’s set up a hypothetical problem and do some calculations. Assume that each arm is length 100 and assume that y-position that we’re interested in traversing is y = 85. Then an initial position for the arm could be 1= 2 = 25.10. This yields 11 Johns Hopkins University What is Engineering? y=100*(sin(1) + sin(2)) = 85. To see the condition for y=const., let’s plot as a function of 1, with d 1 1 . dt M. Karweit d 2 cos(1 ) d1 dt cos( 2 ) dt First, why do we choose this particular plot? There are four variables involved: 1 , d 1 d 2 , and . But 2 can be determined through geometry by 1. And we really don’t care dt dt d 1 d 2 about the specific values of and . We care only about the value of their ratio. So one dt dt d 1 1 . of these rates can be picked arbitrarily; for example dt 2 , d 1 d 2 to changes dt dt approximately linearly with 1 , i.e., the graph is almost a straight line. This means that, if the d 1 1 ), the second motor should uniformly first stepper motor rotates at a constant rate (say, dt accelerate as 1 is swept out. That we can do with our simple programming capabilities. Now this is an interesting graph. It says that the ratio of d 1 d 2 to at the beginning of a programmed dt dt segment, and assign an acceleration term to 2 (t) so that the appropriate ratio exists at the end of the traverse, the middle of the traverse will pretty well take care of itself. So, if we start out with the appropriate ratio of See if you can figure out how to do this with Robotic Arm simulator. Remember, pick some angle through which stepper motor one should operate. This will determine 1, since a 12 Johns Hopkins University What is Engineering? M. Karweit program segment will operate from t =0 through t=1. For this 1, calculate an 2 , so that the d 1 d 2 ratios of to are correct for this beginning point. At the end of the time segment (if 1 = dt dt 0), the value of 1 at t = 1 will be 0 + 1. At this new position, calculate what 2 should be. Then calculate the coefficient 2 so that, by the time t =1, the correct value of 2 will be attained. d 1 d 2 The coefficient 2 produces the linear change in the ratio of to that is suggested by the dt dt plot. Understand that this recipe is still an approximation to the solution. The arm tip will not traverse at y = const. But it will be close—maybe close enough for the particular task. So, this is an engineering solution, not an analytic solution. And it demonstrates one aspect of the field of robotics. 13