ROBOTLAB: A SOFTWARE FOR ROBOT GRAPHIC SIMULATION
Transcription
ROBOTLAB: A SOFTWARE FOR ROBOT GRAPHIC SIMULATION
ROBOTLAB: A SOFTWARE FOR ROBOT GRAPHIC SIMULATION Narpat s. Gehlot Universidade Federal da Paraíba - Departamento de Engenharia Elétrica 58109 - 970 Campina Grande-PB-Brasil E-mail: [email protected] Pablo J. Alsina Universidade Estadual da Paraíba - CCT - Departamento de Física 58100-000 Campina Grande - PB - Brasil Abstract: The ROBOTLAB is a MATLAB based software package developed for robot simulation and analysis. MATLAB users can analyze and simulate any arbitrary serial link manipulator using ROBOTLAB by specifying robot kinematics, geometric and dynamic parameters. The package incorporates an extensive library of functions of transforrnations, kinematics, dynamics, control, trajectory and 3D animation of robots . IIIustrative examples are presented to show the capability of the ROBOTLAB. 1. INTRODUCTION The availability of powerful software packages such as Mathematica, MATLAB and MAPLE, has motivated the development of software tools for the analysis and simulation of robotic systerns (Nethery & Spong, 1994; Corke, 1996). Also, for Unix operating systems a robot graphic simulator (Marhefka & Orin, 1996) has been developed which is portable over wide range of platforrns . The use of software based tools for the simulation and analysis of robotics systems provides a very attractive solution of design problems & is ideal for educational purposes, since the cost of experimental setups is generally high. Moreover, the flexibility of the software tools perrnits convenient training and teaching aids (White, et al., 1989) as well as allows the investigation of control strategies without the need of an experimental prototype (McMillan, et aI., 1995; Agba, 1995). In this paper, the ROBOTLAB: A Graphic Robot Laboratory Simulator (Alsina, 1996) is described which consists of a versatile robotics functions library , interactive graphic user interfaces and forceful 3D animation tools . ROBOTLAB was developed for personal computers, running MATLAB 4.0 in Windows . Given an appropriate description file of any arbitrary N-link serial robot, the ROBOTLAB functions, like MATLAB functions, are used in the analysis, dynamics simulation and 3D animation to create a Virtual Prototype. ROBOTLAB user interface is described in Section 2. In Section 3, robot modeling commands are discussed . Section 4 presents a general description of the RüBOTLAB environment, including details of the different program modules and graphic output interface. An iIIustrative example is given in Section 5 to show the versatility of the package. A comparison with other state-of-the-art packages is given in Section 6. 2. ROBOTLAB USER INTERFACE J 465 ROBOTLAB is an interactive environment for robot analysis , dynamic simulation and graphic 3D animation. ROBOTLAB front end is a friendly graphical user Interface, developed in MATLAB, which provides an easy way of executing the ROBOTLAB tasks. The ROBOTLAB command functions (see Table I) are norrnally transparent to. the user and are utilized for writing RÇ)BOTLAB user programs. Figure 1 shows an example of the Graphic user interface. _ . -'f-diLWlndows _. . .- - ::·_..lielp _ _. ..... . - ' file. •... .- . .. . .. "-- - ' ...... variables : one for the forrn and size and other for the reiative positioning of the part in the link . The first variable foIlows the forrnat: P<xx>L <yy>, where <xx> is a two-digit number associated to the part and <yy> is a two-digit number associated to the corresponding link. This var iabIe must be initialized by means of an appropriate graphic primitive function in order to store the forrn and size of the corresponding part oThe second variable defines the relative positioning of the part with respect to the link reference frame by means of a homogeneous transformation. The general format of this variable is TP<xx>L<yy>, where <xx> and <yy> were defined above. For example, the part 3 of link 4 could be created as: .... . . t, .. ,. I.: F·OBOTL.A.B -] r ;:"., ·1· ·1 Fig. 1 - ROBOTLAB Menu . P03L04 = [2 3. ROBOT MODELING 0.5] TP03L04 = [ I O O O Any serial robotics manipulator can be simulated in ROBOTLAB. The manipulator is specified by the user by a proper parameter file in the format MATLAB "script-file". This file includes the kinematics, dynamics and geometric parameters of a robot to be simulated. The input data (from files or keyboard) is written in the MATLAB language forrnat: matrix between brackets, elements in a row separated by blank spaces and each row separated by a semicolon. The kinematics parameters are given in a matrix named KINPAR. Each one ofthe N rows of matrix KINPAR consists of tive elements that describe completely the kinematics of one link: the type of joint and the four Denavit-Hartenbeg parameters (ai, ai, di, ai) (Craig, 1986). For example, for single-link system with a rotational joint, the cinematic parameters.are specified as: O 1 O O O O 1 O 5 O O 1]; The numb er 2 in part P03L04 is a code for a hemispheric part and 0.5 is the radius length . The variable TP03L04 indicates that the hemispheric part is aligned with the reference frame ofthe link 4 (rotation matrix equal to identity matrix) and its center is localized 5 units in the positiv e direction of the x-axis of the frame . Using the geometri c modeling form given above, user can specify any robot of desired structural detai ls. Figur e 2 shows an example ofrobot manipul ator geometric modeling. 1, 0.8 N 0.4 Similarly, the dynamics parameters are given in an N row matrix named DYNPAR. Each row includes the mass (m.), vector of center of mass (S = [S, S, Sz]T), inertia tensor elements n, = n, Iyy I,z]T and I, = [Iyz .Ixz Ixy]T), Coulomb friction coefficient (Ac) and viscous friction coefficient (Av) of.one link. For example, for single-link ' system with a rotational joint, the dynamic parameters are specified as: 0.2 0.5 o Y(m) -o. -0.5 X(m) Fig. 2 - Example ofrobot geometric modelin g. The geometric model of the robot is\ composed by links, which are numbered sequentially, starting from the base of the manipulator. Each link is Cõmposed by several numbered parts (graphic objects), which are created using some special graphic primitive functions (prism, cone, cylinder, sphere, hemisphere). Each part is specified by two 4. THE PROGRAM 4. J General Characteristics ROBOTLAB is structured in several module s, which can be expanded accordin g to the user needs . ROBOTLAB is divided: in . six main modules : 466 / Homogeneous Transfonns, Trajectory Generation, Kinematics, Dynamics, Graphics and Dynamics Simulation. Each module consists of a set of MATLAB functions, developed for each specific problêrn, and, due to the open structure, they can be utilized by the user in his own programs. A list of the available ROBOTLAB functions is given in Table I. <, 4.2 Homogeneous Transforms This module includes severaI functions to deal with the homogeneous transfonns, which are used to describe link translation and orientation. 4.3 Trajectory Generation This ROBOTLAB module consists of a set of function for trajectory generation (position, velocity and acceleration) in joint space. The trajectory generation is realized through a 5º order polynomial interpolation between the initial and final point of the path. This module includes functions to update the polynomial coefficients and the state vector at any instant ofthe trajectory. The generated trajectory is stored in a file named trajdata.mat (Trajectory generation results). Table I ::.List ofROBOTLAB Functions HomogeneousTransforms rotmatx Homogeneous transfonn about xaxis. rotmaty Homogeneous transfonn about yaxis. rotmatz Homogeneous transfonn about zaxis. Trajectory Generation 5!h order coefiraj Coefficients of polynomial for trajectory interpolation. traject Trajectory generation. trajpnt Specific point of a trajectory. Kinematics transfor Link homogeneous transfonns. transfb Link homogeneous transfonns in base reference frame. eulerang Eu ler angles. dirkin Direct kinematics. invkin Inverse kinematics. homepos Home position. Dynamics dirdyn Direct dynam ics. invdyn Inverse dynamics. inermat Inertia matrix. inertorq . Inertialload. reactorq Non-inertial load. coritorq Coriolis/Centrifugalload. gravtorq Gravitational load. visctorq Viscous Friction. coultorq Coulomb friction . Dynamics Simulation rgkrobot Runge-Kutta solution of robot dynamics. State derivatives ofrobot dynamics. robotdyn Graphics Cone-type graphic object. pcone Cylinder-type graphic object. pcylind Hemisphere-type graphic object. phemis Prism-type graphic object. pprism Sphere-type graphic object. pspher ofa link . Graphic display showlink of a part ofa link . Graphic display showpart Graphic display ofa robot. showrob showunif of unifilar Graphic display diagram o Transforms position and transfpa orientation of graphic object. 4.4 Kinematics This module includes a set of functions related to the kinematics of manipulators: Home Position, Link Transfonnations, Direct Kinematics, Inverse Kinematics, Euler Angles, etc. Due to the complexity of the inverse kinematics problem, a "script-file", for computing the inverse kinematics of its own robot, must be fumished by the user . This file must update the vector of joint variables from a given position and orientation of the tool. The user has the option of 3D view of the manipulator in the chosen spatial configuration. 4.5 Dynamics This module includes several functions, based on the Newton-Euler fonnulation (Featherstone, 1987), for computation of the tenns of the dynamics equation: Direct Dynamics, Inverse Dynamics, lnertia Matrix, Coriolis/ CentrifugaI Torques, Gravitational Torques, etc. 4.6 Dynamics Simulation This module consists of a dynamics simulator for serial manipulators based on numerical integration through a fourth-order Runge-Kutta method. A controller script-file must be fumished by the user to implement his own robot control law, however, a standard Computed Torque Controller is provided in the ROBOTLAB. "Measured" values of position, velocity and acceleration can be used for this file to update the driving torque vector in a variable named TORQ. The initial state and the simulation time are interactively requested by the programo The manipulator state is updated in the matrices THIST (simulation time), QHIST (joint var iables), DQHIST (joint velocities) , D2QHIST (joint accelerations) e TORQHIST (driving torques). Beside these var iables , the following variables are associated to 467 the reference trajectory: QRHIST, DQRHIST and D2QRHIST. The simulation resuits are storedin a file named simudata.mat (Dynamics simulation response). 11 I N 4.7 Graphic Results II 0.4 As explained in Section 3, by using a set of graphic . primitive functions, the user can construct a 3D graphic model of its own manipulator, including as many details as one wants. By means of this model , RüBüTLAB can be utilized to execute several kind of graphic simulations, resuiting in a powerful 3D animation tool for robotics. The RüBüTLAB graphic output module includes time response curves, 3D animation, 3D tool trajectory, unifilar diagram, etc. Figures 3, 4 and 5 show the graphic capabilities of the RüBüTLAB. I I 0.2 01I, Y(m) X(m) Fig, 5 - 3D Animation with multiple poses . 5. APPLICATION EXAMPLE RüBOTLAB can be used as an educational aid in Robotics, as well as a design tool for off-line testing of control strategies. Suppose, for example, that the arm , shown in Fig. 2, is required to track a circular trajectory in Cartesian space. üne way to accomplish this is updating, through inverse kinematics, the corresponding joint references frorn the desired Cartesian trajectory, and then, computing the driving torques by a computed torque control law. Figure 6 shows the user file code needed for this task. This file updates vector TORQ of driving torques, utilized by RüBOTLAB for the simulation . % COMPUTED TORQUE CONTROLLER FILE 2 t(s) t(s) % Circular Trajectory Generation in Cartesian Space Fig. 3 - Time Response graphic output. t=2*pi* simtime/maxtime; % Time Interval POSVEC=[R*cos(t); pycenter; di +R*sin(t)); ORIENTMAT=eye(3); 1, O. % Inverse Kinematics & Reference Trajectory In. N Qr=invkin(ORIENTMAT,POSVEC); DQr=(Qr-QrO)/samplingtime; QrO=Qr ; D2Qr=(DQr-DQrO)/samplingtime; DQrO=DQr ; O. o. o % Tracking Error & Command Acceleration <, CID " Err=Qr-Q; DError=DQr-DQ; D2Qc=D2Qr+Kd*DError+Kp* Error; . <' //' 0.5 % Computed Torque Controller Y(m) X(m) TORQ=invdyn(Q,DQ,D2Qc); Fig. 6 - Computed Torque Controller - User file Fig. 4 - Unifilar Diagram 468 Note that vectors Q and DQ (joint trajectories and joint velocities) are available "measured values", that the user can utilize for controller feedback. Figure 7 shows the simulated time response and corresponding driving torques for this example. It can be noted the high torque required by joint 2, due to the high gravitational load over this joint. Figure 8 shows the corresponding Cartesian trajectory tracking. . (a) 1 educational purposes. Other simulators with the same overall goal are Xanimate (Marhefka & Orin, 1996), Robotica (Nethery & Spong, 1994) and Robotics Toolbox (Corke, 1996). Xanimate is a powerful tool for graphical simulation of robotics systems of any topological structure and is portable on a wide range . of platforms. However, the Xanimate does not include dynamics simulation, whereas ROBOTLAB petforms both dynamics and graphics simulations. Robotica is a computer aided design package for serial manipulator, including dynamics simulation, based on the Mathematica package, Simnon and a C language front end . Robotica is capable of generating symbolic solution for robot kinematics and dynamics, whereas, ROBOTLAB provides numeric solutions. Both Robotics Toolbox as well as the ROBOTLAB are ao extension of MATLAB language, although ROBOTLAB also runs with a Windows front end . The Robotics toolbox has a more complete set of robotic functions than ROBOTLAB, but ROBOTLAB is more versatile and realistic in graphic animation capabilities. A MATLAB compiled version will further improve this salient features of the ROBOTLAB. Joint Angles . 2 -1f O 0.2 0.6 0.4 0.8 (b) Driving 1 Torques . .. ... 3 .. __. O 0.2 0.4 0.6 0.8 . , .' 7. CONCLUSION 1 t ts) The graphic robot simulator ROBOTLAB was presented. This program, based on MATLAB language, includes several open modules and can be expanded and improved by the user. The ROBOTLAB provides user friendly graphic interface and graphic output with 3D animation. These features make the ROBOTLAB a suitable tool for research and teaching. The suggestions for future work to enhance the functionality of ROBOTLAB are : Simulation of any fixed topological robotic structure, Inclusion of collision detect ion , Expansion of GUI & CAD based generation of parameters. Fig. 7 - Time response for tracking a circular path. a) Joint Variables. b) Driv ing Torques. 1J o.J i N I I I OA i I I oi APPENDIX 0.5 Dynamics Simulation by Newton-Euler Method o -0 .'5 Y(rn) The robot dynamics simulation problem can be stated as follows : given the vector of driving torques and the initial state, update the time response of the arm position. This can be attained by the numerical integration of the direct dynamics of the Nvlink manipulator, which is represented by the following non-linear second order differential equation, -0 .5 X(m) Fig. 8 - Circular Trajectory Tracking. 6. COMPARISON WITH OTHER PACKAGES q Although powerful commercial robot simulation packages such as SILMA are available, most of them were developed for industrial needs. The ROBOTLAB was developed for research and = (1) were, t is the Nx 1 vector of driving torques, q is the Nx 1 vector of joint positions, M( q) is the NxN 469 \ inertia matrix and '[ d (q, q) \is the Nx I vector of coriolis, centrifugaI, gravitational and disturbance torques. The computation of the driving torques (inverse dynamics) can be realized in an efficient recursive way by means ofthe Newton-Euler method (Featherstone, 1987). This formulation method is realized in two stages: the Forward and Backward Recursions. In the Forward Recursion, the cinematic variables are transformed recursively from the base to the robot tool. In the Backward Recursion, forces and torques are updated recursively from the tool to the base of the robot, thus allowing the computation of the joint driving torques: - Forward Recursion: utilized for the inertia matrix computation by an indirect way (Walker & Orin, 1982). First, the vector of coriolis, centrifugai and gravitational torques, 'td is updated from : (8) where '[(O) is the solution of the Newton-Euler (9) where vector r = e algorithm for the vector of joint accelerations equal to zero. Then , each column M, of the inertia matrix is obtained from: (O) is the solution of the Newton-Euler algorithm obtained by imposing (2) e = o for j:t= i . e = 1 for j = ·i e j j REFERENCES jT . j j p. I )) + A 1+. I (ro.X p.1+ , + V. I· + ffi·1 x.(ffi·x 1 t 1+ = (4) - Backward Recursion: f; = A;+1f;+1 XlTI;Si +ffi; X(ffij xmsj-r mv, (5) n A;+l j+l + j'pj+l x(A:+,fj+l)+I jcO j + +ffi j xl jffij \ ZTn.+zTf I t I I -i m.s, XV.Y (6) (7) where ffii , cOi are respectively the 3xl vectors of angular velocity and acceleration the link i reference frame; j is the 3xl vector of linear acceleration of link i reference frame; f; and n, are the 3x 1 vectors of force and torque applied on link-i-l)y link i-I; m, is the mass of link i; Ij is the inertia tensor of link i expressed in its own reference frame; Si is the 3x I vector of position of the center of mass of link i. ipi+) and À:+I are respectively the 3x 1 position vector and 3x3 rotation matrix of frame i+ I in relation to frame i. Zj = [O Ol]T, (Zj = [O OO]T) if joint i v is rotational and Zi joint .i is prismatic. = [O OO]T, (Zj = [O Olf) if The robot dynamics simulation problem involves the numerical integration of Eq. (I), thus , the computation of the inverse of the inertia matrix is necessary. The Newton-Euler formulation cannot be used directly for the direct dynamics calculation, because it only updates the vector of driving torques. In spite of this , the Newton-Euler method can be 470 Agba , E. I. (1995). "SeaMaster: An ROVManipulator System Simulator". IEEE Computer Graphics and App lications, pp. 24-31 . AIsina, P. J. (1996) . "Modular Adaptive Neurocontrol of Robotic Manipulators" : Doctoral Thesis (in portuguese), Federal Univ. of Paraíba, Brasil. Corke, P. I. (1996) . "A Robotics Toolbox for MATLAB". IEEE Robotics and Automation Magazine, Vol. 3, No. 1, pp. 24-32 . Craig, 1. 1. (1986). "Introduction to Robotics Mechanics & Control". Addison-Wesley . Featherstone, R. (1987). "Robot Dynam ics Algorithms". Boston Kluwer Academic Publishers. Marhefka, D. W. & D. E. Orin (1996) "Xanimate: An Educational TooI for Robot Graphical Simulation". IEEE Robotics & Automation Magazine. Vol. 3, No. 2, pp. 6-14. McMil1an, S., D. E. Orin & R. 8. McGhee (1995) . " Obj ect Oriented Design of a Dynamic Simulation for Underwater Robotic Vehicles". Proc. of IEEE Int. Conference of Robotics and Automation, Nagoya , Japan , pp. 1886-1893 . Nethery,1. F. & M. W. Spong (1994) " Robotica: A Mathematica Package for Robot Analysis" . IEEE Robotics and Automation Magazine, Vol. 1, No. 1, pp. 13-20. Walker, M. W. & D. E. Orin (1982). " Efficient Dynamic Computer Simulation of Rabot Mechanisms" . ASME Joumal of Dvnamic Systems , Measure. & Control 104, pp .205-21 I. White, R. 8., R. K. Read, M. W. Koch & R. J. Schil1ing (1989) "A Graphics Simulator for a Robotic Arm". IEEE Trans. on Education, Vol. 32, No. 4, pp. 417-429.