Home

Bauer060825 - Centre for Intelligent Machines

image

Contents

1. 1 2 3 4 Cross platform OpenGL support free and support C C In the following we discuss three different toolkits GLUT GLUI In almost every OpenGL documentation 9 the OpenGL Utility Toolkit FOX GLUT is mentioned The GLUT library 6 is based on OpenGL GLU and depending on the operating system functions to use OpenGL Bindings are avail able for C and FORTRAN GLUT provides window definition window control keyboard and mouse I O small popup menus and routines to draw geometric objects All of these functions allow the programmer to build a window that shows OpenGL graphics with a minimum amount of effort Although GLUT is a cross platform library the main disadvantage of GLUT is that it does not provide enough functionality to build an extensive user interface A possible solution for this problem is GLUI a GLUT based User Interface library 7 This C package starts where GLUT ends GLUI builds windows and widgets to create a GUI Because it is based on GLUT it is also operating system independent however the types of widgets available are limited FOX stands for Free Objects for X and is written in C In 1997 it was developed for LINUX applications but the aim became to make it completely cross platform Every line of code not written is a correct one is one of ideas behind FOX To minimize the number of lines of code nearly every widget can be initialized in one single line The types of
2. as Ale nit i Ie x EJ e x F 8 22 _ ES nay e x F e x F Ez 8 23 2 gt Vy e x T 8 24 Ze _ 3 7 8 25 In order to compute the gradient of the objective function the partial derivatives of vectors e and r with respect to vector x have to be computed Partial Derivatives for e The vector e has to be expressed in the first frame J1 In the th frame the vector is always e 0 0 1 7 which leads to 0 e Q Q Q 0 8 26 1 44 The derivative of e with respect to an arbitrary variable y representing any of the design parameters thus becomes e o pa Oy Q Q Q e 8 27 9 a Que A570 Ae Paret de O Qi 8 28 This formula can be simplified for the given design variable It is obvious that any derivative of the vector e e is zero Furthermore the matrices Q do not depend on the variables a and b which leads to OQ _ et 8 29 OQ _ s 8 30 de ol t 8 31 The transformation matrices reach from the first to the i 1 st frame Therefore the design variables a and 0 for the th frame or any following frame have also no influence on the partial derivative of e The partial derivatives reduce to the two expressions below es 0Q Daj Aa d 8 8 32 O lei OQ Where the derivatives for the matrix Q are defined as 90 0 sina sin 6 cos a sin 0 FA 0 sina cos cos a cos 0 8
3. 3 5 OpenGL in FLTK There are a few methods to include OpenGL code in a FLTK interface One is to set up an OpenGL context in a F1_ Window widget This is managed by using the commands gl_start and gl_finish and writing the OpenGL code in between A second possibility is to emulate a GLUT window for drawings The simplest way which is used in this project is to generate a subclass for a widget called 11 Figure 3 1 Small FLTK window F1_G1_Window This widget is then implemented into an F1_Window widget For RVS the F1_G1_ Window is placed in the main FLTK window At least three things must be defined in order to create an OpenGL subclass 1 The class definition itself 2 a draw method to display the drawing and 3 a handle method for all the I O action The following example explains how to display the rectangle mentioned in subsection 3 2 The libraries libopengl32 a libglu32 a and libfltk gl a for correspondingly OpenGL GLU and FLTK OpenGL support must be added to the project at hand After all the header files for the widgets are included the subclass is then defined class MyGlWindow public F1_G1_Window 1 int handle int event 1 switch event 1 case FL_PUSH int m_key Fl event_button switch m_key case FL LEFT MOUSE exit 0 12 void draw set the viewport glViewport 0 0 w h Indicates the buffers currently enabled for color writing glClear GL COLOR
4. 34 ii 0 COS Qj sin a dQ cos 0 cosa sin sina sin 9 jD sind cosajcos sinaycos0 8 35 j 0 sina COS Qj 45 Partial Derivatives for T Similar to the position vector e the vector T has to be expressed in the first frame r Q Qa amp Qam QQE t Q Q 1a 8 36 a NS E A y E EB With respect to an arbitrary variable y the partial derivative r Alri _ 90 1 l ri ay TT dy r Q i By 8 37 OQ Gi o Ben O Qatt Q AA 8 38 r _ 0a 00 an dy gt dy aii tQ 8 39 dQ 0a ES Ost HQ JM Q Qi 1 a Fiss 00 u Hau Q 1An Sahe l Qn Oy 2 The influence of the design variables can be separated As long as the variable z occurs in either Q or aj and j lt 1 it affects only the first term 801 1 0xj r of eq 8 37 The second term Qs r 0x vanishing When j gt i the first term vanishes and the influence occurs only in the second term As explained in the previous subsection the matrix Q does not depend of a and b Also many terms of eq 8 39 vanish for the different cases This leads to the partial derivatives expressions below r for j lt i O r 00 Daj Q 1 da Os m O r 20 00 Qi Q _ 1 06 O A 46 for j i dar Sa a Q gz Qu a Az rn A e GEZE hb om A0 m Bat a TE forj gt i OE a 0
5. BUFFER BIT set color RGB mode glColor3f 1 0 0 draw Polygon glBegin GL_POLYGON glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glEnd public MyGlWindow int x int y int w int h Fl_Gl_Window x y w h F The event handler handle checks if any event has been activated Otherwise it would do nothing For the case when an event is present handle verifies the type of event In the example above FL_PUSH represents a mouse button being pushed while Fl event button returns which button was pushed Finally the exit 0 command is executed when the left mouse button FL_LEFT_MOUSE is pressed The draw method is called every time the OpenGL window is drawn program starts or needs to be redrawn e g changing polygon parameters with a widget The first two OpenGL commands set up the scene and the third command changes the color to red so that the rectangle will be red The last line is the constructor for the F1_Gl_Window widget which is used in the main routine int main F1_Window My window My window new Fl Window 100 100 200 200 OpenGL in FLTK MyGlWindow gl window 10 10 window gt w 20 window gt h 20 My window gt end 13 ll OpenGL in FLTK lee Figure 3 2 OpenGL in FLTK My_window gt show return Fl run This example shows that the size of a widget can be set with respect to another widget The size of the F1_
6. FOX widgets are much more than that of GLUI To show OpenGL rendering a special window can be created FOX would provide everything that the RVS project would need FLTK The third library is the Fast and Light Toolkit FLTK 8 Like FOX it is a C GUI toolkit and supports Microsoft Windows LINUX UNIX and MacOS The history of FLTK shows a direct relation to XForms It was developed to fix the problems that appeared when graphical engine switched to OpenGL This required a rewrite of XForms and as a result FLTK was developed To a certain extent the two toolkits are similar FLTK offers window definition window control and input output functions Furthermore it is designed to be statically linked As a result it is divided into small pieces and only the parts being used need to be linked The result is that FLTK programs are very small and start quickly There are 64 basic widgets in FLTK which are extendible to 92 with minor modifications FLTK is GLUT compatible With modified header files an existing GLUT program can be implemented in FLTK FLTK also offers the possibility to create a special widget for OpenGL applications for more information see Section 3 5 Along with FLTK comes FLUID the Fast Light User Interface Designer This tool is very handy to design an interface Using drag and drop all widgets can be put in the desired place and relevant parameters can be set When everything is correctly placed FLUID can then
7. OpenGL offers no command to set the color with a single value As shown in the example in subsection 3 5 the color is set by three single values for the RGB mode When the RGBA mode is used the command changes to glColor4f There are two possible ways to make the pre defined color values compatible with the new OpenGL command The first possibility would be to rewrite the header file and separate all values into four new one This involves rewriting all the primitives The second option was to add two small functions to the program which take the hexadecimal value save the RGBA entries in four new variables and then change the color with glColor4f One of these functions is as followed void JwSetColor long JwColor float nJwR nJwG nJwB nJwA nJwR JwColorg0x000000ff gt gt 2 255 0 nJwG JwColor amp 0x0000ff00 gt gt 10 255 0 nJwB JwColorg0x00ff0000 gt gt 18 255 0 nJwA JwColorg0xff000000 gt gt 24 255 0 glColor4f nJwR nJwG nJwB nJwA 20 The bitwise and operator is used to separate color value All values are divided by 255 0 because OpenGL expects values between 0 0 and 1 0 for each settings 21 5 Kinematics Engine 5 1 Forward and Inverse Kinematics With the new interface and the working primitives RVS is ready to create robot architectures and render them in 3D However the program also offers animation of robots To accomplish this a kinematics engine is required to solve the inverse and
8. from a small set of geometric primitives like points lines or polygons In OpenGL every command starts with the letters gl A constant begins with GL_ and is written in capital For example to define a rectangle you have to define the polygon primitive and its four vertices During the early 1990 s SGI decided to provide an open standard graphics API for the developing portable 2D and 3D applications The result was OpenGL which was based on IrisGL glBegin GL_POLYGON glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glVertex2f 0 5 0 5 glEnd This means that every 3D object is based on a fairly large number of primitives Some intermediate level libraries built on OpenGL are available The OpenGL Utility Library GLU is one of them and provides routines for 3D objects such as a sphere a cylinder etc Like IrisGL OpenGL is a state machine A state will remain in a particular mode until it is changed For example if the color is set to red in the beginning of the program every functions call would continue to use the red color until the color is changed To keep OpenGL hardware independent no GUI and data handling are included It is up to the programmer to use a separate toolkit to handle such tasks Drawing objects using OpenGL is not enough The programmer must also create the scene e g virtual lights camera etc OpenGL offers functions to create a virtual 3D scene A 3D scene with objects d
9. generate the C code This tool is very helpful when designing the layout of a new window Initially the new interface was created using GLUT and GLUI for the reason explained above An OpenGL window can quickly be developed using GLUT and GLUI Menu and interface creation is also intuitive By defining all the wanted wid get GLUI places them automatically in the best position inside the window However at one point it was recognized that it is not possible to build a new interface with these two packages GLUI has limited widgets to offer For example browsers and sliders are not avaiable Hence simple tasks like choosing the robot architecture from the list would become complicated to manage Several other options were then considered for different toolkits that are not men tions here The two packages that came to focused were FOX and FLTK Finally FLTK was chosen because of the following reasons FLTK is closer to GLUT e The FLTK syntax is easier FLTK comes with FLUID e Sufficient to support RVS functionality 3 4 How FLTK works This section provide a guick overview of how a FLTK program works As mentioned before the package is separated into different parts First the static library libfltk a must be added to the project options in the IDE For every window button etc there exists a header file which is identical in name to the widget type and have the H extension The following example shows how to create a s
10. leads to 4n Denavit Hartenberg parameters for the robot Position vectors e The vector e is defined along the Z axis of the frame F In frame F this vector components are es 0 7 1 37 PSfrag replacements Zi 1 s010 Figure 7 1 Denavit Hartenberg Notation Position vectors a The directed from the origin of the ith frame to the origin of the i 1 st frame is defined by the vector a whose components in F are a cos 0 ai a sin 9 7 2 b Position vectors r The vector r is defined directed from the origin O of the ith frame to the operation point P of the end effector namely r a ai 1 ai 2 an 7 3 To calculate the above vector all vectors on the right hand side of the foregoing expression have to be expressed in the ith frame 38 7 3 Rotation Matrix Q The matrix Q is used to transform a vector or a matrix from the i lst frame into the ith frame This matrix is given by 10 cos 9 cos sin sina sin 0 O sinf cosacos sin o cos 6 7 4 0 sin a COS W For example vector r expressed in the ith frame is r a Qaim Q Q 942 Qi Qaan 7 5 39 8 Tools for the Optimum Design of Robots using Gradient Methods 8 1 Introduction The design of a new robot starts with the determination of performance specifications that should be achieved by the robot On the basis of these specifications the various links will be designe
11. lt lt lt lt lt lt lt KK Model views of REDIESTRO a Fully rendered model b skeleton model Less ace ei ee Kuk a e KI KK KK RVS2006 Directory tree GL doe ee PER is a Denavit Hartenberg Notation 2 2 lt lt lt lt K K K K K K K K K KK N a 9 rare bea 8l a a6 L2 4b 4K ab a Se e vi 1 Introduction 1 1 Introduction Like in any other field of industrial development simulation programs have become a standard tool in robotics These tools can provide invaluable help during the design stage of a new robot or a whole work environment for a specific robot A lot of 3D visualization software packages are commercially available During the 1990s the MeGill University developed its own noncommercial software tool for the simulation of robots called Robot Visualization System RVS This tool was developed for edu cational use and never claimed to be as professional as its commercial counterparts Because the tool was adapted to a specific computer architecture and operating sys tem it cannot be used on an IBM compatible PC using Windows or LINUX The aim of this project is to develop a new software which provides the same functionality as the original RVS In order to minimize the required work parts of the old software should be used in the new one if possible Therefore the existing software needs to be analyzed In Chapter 2 the existing program structure is analyzed to get an overview which could
12. possible to create save and reload a work environment 6 2 4 Feature OpenGL Scene Export Once an OpenGL scene is created and displayed on screen it is quite useful generate an image file for a presentation or a report This could be managed by taking a screenshot which is a raster bitmap based file or by creating a vector based file A screenshot is easy to generate but the quality is not good enough for detailed printouts The advantage of a vector based file is that the exported file will always be a high quality image Therefore a library called gl2ps is implemented in RVS The library can create a vector based file ps eps pdf svg of a OpenGL scene The user has to set the filename and the desired format in the interface window and finally start the export with the shortcut crtl e 3 Outputting the entire screen in a common format such as BMP PNG or JPEG A keyboard shortcut is a key or set of keys that performs a predefined function 29 E OpenGL Scene Export lolx Filename Export File Format ps x set 1 Input filename 00000 2 Choose format 3 Press set button Main window Press Ctrl e close Figure 6 4 OpenGL Scene Export Figure 6 5 Skeleton drawing of a 2 link robot 6 3 How to Create a Fully Rendered Robot This section describes all the necessary steps to create a full rendered robot However first it is important to understand how a robot skeleton i
13. rendered The following example shows how to create a conveyor Thing conveyor conveyor DefConveyor 4 2 3 SeaGreen DrawThing conveyor Two editing primitives are available to translate or to rotate the created object After each object has been defined in the source code the whole project needs to be recom piled This approach becomes tedious for the case when only one position parameter for an object has to be changed Finally it is not possible to exchange a created work area easily between two computers as it is possible for architecture files 27 Figure 6 2 Puma robot Pick and place operation 28 lola Object Conveyor File fworkarea2 Position x loo amp Lenght 18 00 j Position y 650 Y Height 6 00 Positionz 0 00 with 5 00 Rotation jn ka Color Grey Tase wh 15 save else Figure 6 3 Interface window for Work Environment Creating a Work Environment within the Interface A new Work Environment entry has been added to the menu A window Fig 6 3 displays all the necessary options to select an object set parameters and place it around the robot To create a new object the user must increase the ID number Each object and its parameters can be identified with this ID number The limit for the maximum number of objects is set inside the source code and is currently set to 20 objects Finally the created scene can be save to a simple text file Hence it is now
14. rendered model robotname c These are the files for the defined fully rendered models matrix This folder contains several files for mathematical operations such as cross product matrix vector multiplications or Cholesky decomposition gl2ps This folder contains all files for the gl2ps library 6 5 Required Library files To compile the source code some libraries have to be added to the linker options The following table includes all required libraries for a WIN32 application FLTK library libfltk a Libraries used by FLTK libole32 a libuuid a libcomct32 a libwsock32 a libm a OpenGL library for FLTK libfitk gl a Standard OpenGL library libopengl32 a GLU library libglu32 a Windows GDI libgdi32 a 35 7 Geometry of Serial Robots 7 1 Revolute and Prismatic Links The architecture of a serial robot can be described as an assembly of several rigid bodies or links thereby forming what is known as a kinematic chain Two links are coupled by a kinematic pair also termed a joint Depending on the type of contact between the two links the kinematic pair can be either lower or higher Only the two basic lower types are considered here as their higher counterparts appear in robots only exceptionally Turning Pair This type is also called a revolute joint The contact surface between the two links is a surface of revolution not allowing sliding along it
15. 0 08 Get Ao o o z rn Q Q _ Fe Q Q 190 aji Q Q ir 03 1 Qu 2n Em Qi Az FO EW O e 8 4 2 Gradient of fz In functions fa the inverse of the matrix product comes into the picture and hnece the gradient of an inverse matrix A is needed This is readily calculated below From we obtain upon differentiation with respect to y whence AA 1 Dy AA dA Oy 1 i 8 40 Cay A Ea JA RE 1 Z 1 S A 47 The gradient of fa thus reduces to tr A urn HTH a 8 41 ce er Em 8 42 All derivatives required in the above expression were defined in the previous subsec tions 8 5 Conclusion and Recommendations for Further Work During this project only a first attempt to compute the gradient of the objective func tion was programmed Because the final algorithm should be available in a MATLAB and implemented in RVS MATLAB was used for the first developments In order to minimize the changes between the MATLAB and the C codes only methods are used that are basic C functions or available in the RVS mathematical library The RVS mathematical library matrix folder includes several function to calculate for example a cross product matrix x vector multiplications or the Cholesky decom position Also a function to compute the Jacobian matrix is implemented in RVS However as long as C does not support symbolic calculations every partial derivative has to
16. 2 Denavit Hartenberg Notation lt lt lt mn Ter Rotation Matrix Cese k RARA ec 8 Tools for the Optimum Design of Robots using Gradient Methods 8 1 Introduction essa un ar a K K KI ee 82 Mathematical Background a 8 2 1 The Jacobian Matrix 8 2 2 Condition Number lt lt lt lt nn m mn 8 2 3 Concept of Homogenous Space 3 lt vu 2 2 bec dee 44 8 3 Optimization Problem scsi rain 8 4 Method of Solution lt lt lt lt lt lt lt s 4 0000000000 eee 8 4 1 Gradient of f si 2 0 25 22 de ae teten 8 4 2 Gradient of Jy z Du Sant a Soak K K K K ne E 8 5 Conclusion and Recommendations for Further Work 9 Conclusion and Recommendations for Further Work Bibliography A Architecture File REDIESTRO B RVS2006 Screenshot C Bugs in RVS 55 57 List of Figures 2 1 3 1 3 2 5 1 6 1 6 2 6 3 6 4 6 5 6 6 6 7 7 1 B 1 Basis Structure of RUS Small FLTK window OpenGL in FLTK 223 kazde Poe RS GRRE its Flowchart IdleCallback 0 0020000000 00000000 Interface windows for New Robot a Menu Load Robot b Menu Create Robot Paramertes lt lt lt lt lt lt lt lt K KIRI KIKI Puma robot Pick and place operation Interface window for Work Environment OpenGL Scene Export x z d 22 2 4 2 0 ee na ad ee a ae K Skeleton drawing of a 2 link robot lt lt lt
17. 42 Graphics Library lt kk KK KEKE KEK a a A ee 3 3 Graphical User Interface kK KEK Vera Bra K K K KK 9 4 How FLIK works s oe bs apost a nad o Mi La lalek bar a a ca ao pen in PBU 2 a nod bas el ewl eta E eee 2 2 Wu weten 4 RVS Primitives 4 1 The Structure of the RVS Primitive Library 4 1 1 Declaration of the Primitives as as a sa sa oo a Qa 4 1 2 Creating and Handling RVS Primitives 4 13 Creating and Handling Robot Parts 4 1 4 Deleting an Object o K K 4 2 Porting the RVS Primitives Library 5 Kinematics Engine 5 1 Forward and Inverse Kinematics XY KK KI K K K K K K K K K KK KI 5 2 Animations in FLTK OpenGL kK KK K KI K K K K K K KI K K 6 RVS 2006 6 1 Integrated Development Environment 6 2 New Features in RVS edad KE KEKE be KEK a KI KI KI l KK K 6 2 1 Feature New Robot KK KEK KI K K K K K K ea 6 2 2 Feature Edit Robot arde K K K K K re el 6 2 3 Feature Work Environment 6 2 4 Feature OpenGL Scene Export 6 3 How to Create a Fully Rendered Robot 64 File and Folder Overview 4 as 2 4 aa ze je 445494 K K 6 5 Required Library files lt lt lt 4 4 K K K KK KK 7 Geometry of Serial Robots 7 1 Revolute and Prismatic Links lt lt lt 7
18. 6 OpenGL a a Ag 413 42 46 Gio G14 43 Ar G11 G14 Q4 Ag Q12 are In general this would not be a significant problem because OpenGL reads the projec tion matrix in the correct order However one of the RVS primitives library s handling function JwEditMultMatrix Matrix M receives a matrix M of type 4x4 array This poses compatibility problems To solve this problem the matrix entries must be placed in the correct format in a 1x16 array before glMultMatrix is called This is managed by two for loops as follows 19 GL_Matrix Mgl for i 0 i lt 4 i for j 0 j lt 4 j Mgl i 4 j M j i With this solution all the pre defined matrices can remain unchanged in the program If the entries are in the wrong format the robot model is not rendered correctly the result being misplaced parts in the OpenGL Scene No Exact Equivalent This paragraph provides an example and the solution for the type of porting scenario without an exact equivalent The IrisGL command cpack is used to change the active RGBA red green blue alpha values It expects a single integer value in hexadecimal notation where the four components range from 0 to 255 For example cpack 0xFF004080 sets alpha to OxFF 255 blue to 0x00 0 green to 0x40 64 and red to 0x80 128 In RVS primitives library all the available color values are defined in colors h and use definition names like Black SeaGreen or WarmGrey Unfortunately
19. All these features are very useful to programm big projects The programmer includes several files to a project sets all the linker and compiler options and the IDE builds automatically an executable file Initially Microsoft Visual Studio NET 2003 was selected However this choice was changed latter to Dev C from Bloodshed Software Of course the company s name sounds a bit curious but Dev C has some very useful features to offer First of all it is quite small around 10MB and published under the GNU GPL making it a free software that can be downloaded under www bloodshed net devcpp html As a result every user who wants to edit the source code later can easily install the IDE and open the RVS project on their computer Another feature of this programm are small packages called DevPaks These pack ages are plug ins e g OpenGL FLTK GLUT for the IDE and are also available online On users demand Dev C can download and install all the required libraries on the computer The process is transparent to the IDE user programmer The current version of Dev C is only available for the Microsoft Windows operat ing system An alternative could be Code Blocks This IDE runs also under LINUX can open Dev C projects as well as use DevPaks Furthermore any other IDE could be used 6 2 New Features in RVS 6 2 1 Feature New Robot In the original RVS software was no function to create a new architecture within the program Th
20. Diploma Thesis The Development and Implementation of Kinematics Algorithms on RVS Robot Visualization System Frank Bauer August 25 2006 Fachhochschule M nster Abteilung Steinfurt Fachbereich Maschinenbau Erklaerung Hiermit erklaere ich die Diplomarbeit selbststaendig verfasst und keine anderen als die angegebenen Hilfsmittel verwendet zu haben Brilon August 25 2006 Frank Bauer Abstract This report describes the development of a computer program for the simulation of robots The program is called Robot Visualization System RVS 2006 and is based on a software package also called RVS that was developed over 10 years ago Because the original RVS was adapted to a Silicon Graphics Workstation the software is not compatible to current computer architectures Therefore the source code of RVS needs to be modified in order to use the tool on an IBM compatible PC The aim of this report is to document all steps that are required for this task Zusammenfassung in deutsch Contents 1 Introduction AA a AI A ae k Lak CE 1 2 Robot Visualization System lt lt lt lt 4 K K 2 eae 13 Usine RVS ae e eo A o ERT e a E AT E A E 4 so es ed l ew aa et pa A ae drei Re 2 Overview of RVS 2 1 Introduction 2 lt lt oo mon 2 2 The Main Structure of RVS III K K K K K KEK KEK 3 User Interface 3 1 Separation of the Project s lt lt KK 8 a 265 Ba au 22 bee es
21. Gl_Window changes when the main window gets bigger or smaller The result of this example is shown in Fig 3 2 14 4 RVS Primitives As outlined in Chapter 2 OpenGL builds all geometric objects from simple primitives Of course it is possible to build a fully rendered robot by defining primitive after primitive and create all the required surfaces However it would be a lot of work to do this especially when many robotic architectures must be created For this reason intermediate level primitives were provided by RVS The final robot design is built using a combination of these intermediate level primitives These primitives are referred as RVS primitives in the following 4 1 The Structure of the RVS Primitive Library 4 1 1 Declaration of the Primitives Nearly 40 different 3D objects can be created with the existing primitives in RVS The basic idea behind every primitive is the same The programmer must define the geometric parameters and rendering options for the primitive and a set of functions handle all necessary steps to generate the OpenGL rendering The following five steps are required for this purpose Structure Definition First the structure of the primitive is specified in the primi tives h header file These are used to save all the necessary geometric param eters like height and radius as well as the rendering options like material and color Public Functions for Primitives In the above mentioned header file a
22. Verlag New York 52 Appendix A Architecture File REDIESTRO k k kk k kk k kk kk ak kok ok kok ok ok ok K REDIESTRO EEEE kk kk kkk geomtype full Link 1 a 0 0 b 9 5229 al 58 3127 th 0 0 limits 170 0 95 0 Link 2 a 2 311300 b 0 2291 al 20 0289 th 20 0 limits 210 0 45 0 Link 3 a 0 b 0 369275 al 105 2568 th 40 0 limits 45 0 185 0 x Link 4 53 a 3 9884 b 0 al 60 9094 th 20 0 limits 35 0 180 0 x Link 5 a 0 b 4 71588 al 59 8823 th 40 0 Link 6 a 1 35589 b 5 78206 al 75 4715 th 10 0 Link 7 a 1 7835 2 3445 b 1 4505 al 0 th 210 0 EndEffector hand 54 Appendix B RVS2000 Screenshot gt M ONO ya NEN ARAN N MN OR ys VY VO X XX x WO Ne E e V NAVY RY VX ami RYS 2006 Robot Yisualization System Figure B 1 RVS2006 56 Appendix C Bugs in RVS e Fully rendered model of TravPuma e Missing labels on frame axes 57
23. a created object In order to edit only the desired primitive the JwEdit commands have to be surrounded by JwBgnEditPrimitive JwPrimitive P and JwEndEditPrimitive where JwPrimitive P represents the variable for the primitive The following exam ple shows how one can create and translate a cylinder using the RVS primitives library JwPrimitive My_Cylinder My Cylinder JwDefCylinder 24 3 0 3 0 JwShinyMetalMat SeaGreen JwBgnEditPrimitive My Cylinder JwEditTranslate 2 5 1 0 3 75 JwEndEditPrimitive JwDrawPrimitive My Cylinder 16 4 1 3 Creating and Handling Robot Parts More complex objects are built from of a combination of simpler primitives We provide here an example that defines the motor object comprising two cylinders a ring and a cylinder fillet Header File typedef struct _JwMotor_ float r float len float h JwMotor JwMotorRec Source File JwPrimitive JwDefMotor float r float len float h int mat JwColor c JwPrimitive P JwMotor B float r1 r2 r3 1la P JwPrimitive JwMalloc sizeof JwPrimitiveRec P gt type JwMotorT P gt spec B JwMotor JwMalloc sizeof JwMotorRec B gt r r B gt len len B gt h h ri 0 7xr r2 0 6xr r3 0 2xr la 1 0xr P gt nu 4 P gt U JwUnit JwMalloc 4 sizeof JwUnit P gt U 0 def cyl fillet 24 r len len 10 len 10 mat c JwBgnEditUnit P gt U 0 JwEditTransla
24. a form a window 1 The X Server is the main component of an X Window System which is used on UNIX LINUX computers to generate graphical interface 2 A widget is an interface component like a button a small browser a output element etc 3 Widget toolkits or GUI toolkits are sets of basic building units for graphical user interfaces Graphical User Interface Xt XForms Xlib Mathematics C Language 3D Rendering Iris GL Figure 2 1 Basis Structure of RVS and place different widgets inside the form Once the form is displayed the user is able to interact with the program The library offers many widgets such as buttons sliders input fields value outputs and so on Also different styles of the widgets are available Here are two examples of how to create a form and a button with XForms CREATE A FORM WINDOW FL_FORM My_form My form fl_bgn_form FL_UP_BOX 320 120 CREATE A OBJECT gt BUTTON FL_OBJECT My_object My object fl_add_button FL_NORMAL_BUTTON 40 70 80 30 Yes The second reguirement for the RVS software package is the graphical engine to gen erate the 3D drawings IrisGL By using a SG Workstation for RVS the choice of the graphical engine was quite simple In the early 1990 s SGI was the world s leader in 3D graphics and the company provided a graphical library for their own workstation In combi nation with the best hardware the Iris Graphics Language IrisGL
25. be programmed This could be managed in two ways 1 The algorithm builds the partial derivative for each combination of e or T and the design variables This requires several if and switch statements for each equation but the final calculations are minimized This method was used in the first attempt for the gradient calculation 2 Another possibility is to calculate first the partial derivative of matrices Q and vectors a with respect to each design variable and use the general expressions for e Ox and r 0x In this case the number of if and switch statements would be less but the number of calculations higher Implementation in RVS Although the development of the algorithm is not very advanced at this stage we suggest a list of the planned steps for RVS implementation 1 Use the pre saved DH parameters as the initial guess 2 Show a rendering of the new architecture after each interaction 48 3 Create a new architecture file or overwrite the existing file The overwrite func tion should be deactivated when a fully rendered model is defined for the select architecture 49 9 Conclusion and Recommendations for Further Work Conclusion The Robot Visualization System 2006 RVS2006 is a free software package for the simulation of robots Appendix B With the program it is possible to render a skeleton model or a fully rendered model of a robotic architecture For a skeleton model only an ASCII file wit
26. be used in the new software Based on the results of the analysis three main steps are necessary to develop the new software First of all a new user interface is required Chapter 3 presents three different packages which can create a Graphical User Interface and describes the one which was used for this project more detailed The original RVS offers a Primitives Library which was used to create 3D objects Every robot model was built from several of these objects This Primitives Library is based on an old graphics engine and cannot be used in the new programm Chapter 4 describes the modification with a new graphics engine in order to make the library compatible Finally the required Kinematics Engine is mentioned in Chapter 5 Once these parts were programmed ported the functionality of the program could be extended Chapter 6 presents four new features which were implemented in the new tool called RVS2006 Chapter 6 also includes an overview of the structure of the program in order to support other programmers in the future Chapter 7 gives an introduction in the Geometry of Serial Robots which is required for the development of new robots in RVS2006 The last part of this project was to develop basics for an optimizations algorithm which should be implemented in RVS in the future These tools are provided in Chapter 8 1 2 Robot Visualization System The Robot Visualization System RVS is a small and easy to use tool for simulation of ro
27. became the standard API of that time For this reason all the 3D renderings in RVS are created using IrisGL 4 Silicon Graphics Incorporated until 1999 5 API stands for Application programming interface 3 User Interface 3 1 Separation of the Project The whole project may be divided into the following three parts 1 New Platform Independent User Interface 2 Graphics Library 3 Kinematics Engine The first task is to create the new user interface with the menu and all required windows and widgets OpenGL should then be tested to ensure that it is working properly within the new GUI Once this is done the existing primitives to draw the robot can be modified with the new graphical engine The last step is to include all the functions like the kinematics engine step by step into the new interface 3 2 Graphics Library Following the aims of this project namely to be platform independent the old graph ical engine IrisGL must be replaced Because IrisGL works only on Silicon Graphics workstations with the Iris operating system it can not be used in the new software OpenGL The new engine called OpenGL works nearly the same way as IrisGL The Open Graphics Library is a cross platform API for 2D 3D computer graphics by SGI About 120 commands can be used to create various graphical object but these commands are low level functions It is not possible to build complex 3D objects with a single command All objects have to be built
28. bots It was developed at the McGill University s Centre for Intelligent Machines on a Silicon Graphics SG Workstation The aim was to support the user during the design process of a new robot With just a few input variables 4 for each link RVS is able to produce a 3D rendering of the robot s skeleton RVS provides the following additional functionalities e Each joint variable can be controlled individually e joint limits can be set e the robot can be moved to pre stored postures e the robot can be made to follow pre stored trajectories e frames for each link can be displayed and e obstacles can be placed in the workspace Finally it is possible to program a fully rendered model for a robot 1 3 Using RVS To start RVS the user has to type sim1 in the UNIX prompt The main RVS window appears and shows the RVS Workspace Using the pop up menu different functions can be chosen The whole package is a window driven environment meaning that for each function a new window is shown Inside the program the user can navigate using the mouse 1 1 4 Objectives Since the development of RVS computers have improved significantly both in their quantity and in their computation power Today nearly everyone has access to a desktop PC or a laptop The computation power and the graphical support of current systems is enough to support the functionality of RVS Hence a rather expensive SG machine is no more required To make RVS ava
29. d There are different methods to define the fundamental geometry for a robot like Burmester Theory or the minimization of the condition number of the Jacobian matrix at one robot posture The latter approach was used of Khan and Angeles 3 and is also used in this project The following sections give a brief introduction Remark For brevity the details of derivations below are not included in this report but the pertinent references are included 8 2 Mathematical Background 8 2 1 The Jacobian Matrix In robotics the Jacobian Matriz J is defined as a 6 x n matrix mapping the set of joint rates 0 into the twist t of the end effector namely J0 t where Ta e e ia en e XT amp XTa X Ta 8 2 2 Condition Number The condition number is a measure of the roundoff error amplification of the computed results with respect to the roundoff error of the input data The general definition of 40 the condition number of a nonsingular matrix A is possible when all matrix entries have the same physical units In that case the condition number is defined as K A AA 8 1 where stands for a arbitrary matrix norm In this report the Frobenius norm r is used throughout The Frobenius norm of the n x n nonsingular matrix A s defined as Ar y PA y in ATA 8 2 The Frobenius norm of A is defined as AT y aa y Para y lafaa 8 3 Finally the Frobenius norm condition nu
30. direct displacement problem Direct Displacement Problem It may be defined as Given the joint displacements of a serial robot compute the position and orientation of each link of the robot Inverse Displacement Problem It may be defined as Given the EE pose position and orientation find all the joint displacements of the serial robot This problem accepts either unique multiple or no solution For both problems a algorithm is available in the original RVS software The engine in hand uses only C language calls and has no elements of either OpenGL or XForms Hence this source code could be implemented in the new software without any change 5 2 Animations in FLTK OpenGL Calculating the new link position in Cartesian space is only half the task The remain ing half is to display the animation in the OpenGL scene It is quite easy to calculate the new position for each link and redraw the completed model The effect is that the robot jumps from the old posture to the new one In fact this is the basic idea of motion in RVS When the robot follows a predefined trajectory RVS simply renders the intermediate postures sequentially As long as these intermediate postures are close together this appears to be a smooth movement Three steps are required to generate an animation 1 Load the new posture from a saved file 2 calculate the new position for each link and 3 update the robot model 22 How these steps are managed i
31. e 6 6 b shows the skeleton model for the same robot with the standard link design 3 Modifications Once the Robot file is complete the files Links h and Links c have to be modified In these files the new robot file must be implemented so that the program can render the full geometry when the architecture is selected The Links files include functions to draw the defined model 4 Recompiling The last step is to compile the new robot file and the modified files to create a new executable file 32 RVS 2006 J include rs src Arch graphics Ctraj links JConfig matrix Jtray gl2ps Workarea Figure 6 7 RVS2006 Directory tree 6 4 File and Folder Overview The major problem during the analysis of the original RVS was the lack of documen tation As mentioned in Chapter 2 the RVS user manual offers little in the overview of files and folders This becomes particulary evident when some of the important files are not even mentioned in the available overview Hence the only way to find a functions was to go through the source code which was tedious and time consuming To facilitate future programmers we aim to include a more detailed overview of the file structure In the interest of space a general outline is provided Figure 6 7 shows the directory tree of the RVS project and the following explains the folders and special files Directory Filename Explanation include This directory contains
32. e user had to open an ASCII text editor and write a file for the new 1 GNU General Public License 2 ASCII American Standard Code for Information Interchange 25 m Load Robot ES Select Architecture mi Create Robot Parameters Ioj xj Filename Robot42 Puma560 Puma 60 bak Puma 60 Home Puma 60 original REDIESTRO REDIESTRO AS a 145 0 5 3 9 REDIESTRO AS2 2 e Tor REDIESTRO spheric b 112 6 0 75 1 75 REDIESTROB REDIESTRO new al 30 5 fo jen las RagharanRoth v bp p Po Jed Cem Robot Links masof El ok Prismatic v u r a b Figure 6 1 Interface windows for New Robot a Menu Load Robot b Menu Create Robot Paramertes architecture In order to make RVS more user friendly the program can now take care of this task within the user interface In this vein the user must define the number of links Fig 6 1 a the file name the DH parameters and the joint type Fig 6 1 b By clicking the save button the program creates a new architecture file in the Arch directory The program verifies whether the selected filename already exist In that case the user has the choice to overwrite the existing filename or to provide another filename Once the new file is created it can be selected from the file browser 6 2 2 Feature Edit Robot Another feature added is the ability to edit the saved parameters within the interface When the user changes a DH parameter the r
33. ew Fl Window 100 100 180 100 How FLTK works and ends with My_window gt end All widgets that are created between these two lines of code are placed inside the window The following table shows the structure for most widgets Command Example 1 Type FI Widget FI Value Output 2 Variable name My_ output 3 Constructor Fl_Widget x y Fl_Value_Output 75 50 width height label 40 30 Output 4 Method name gt method parameter output gt value 42 if necessary The position parameters x y for a widget define the distance from the upper left corner of the window For a window the reference point is the upper left corner of the screen These parameters are optional specifications When no position is provided the program uses the default value of 0 Also the label statement is optional The method functions can be used to set values change the design parameters deactivate a widget set a callback function etc For example the labelfont for the F1_Button is set to bold and italic in the source code above Finally the FLTK program ends with My_window gt show return Fl run The former line a method displays the defined window with all widgets on the screen With the latter command the program enters the FLTK event loop This loop runs continuously so that the program can react to any events such as button are pressed mouse movement etc Fig 3 1 shows the output of the program
34. ewRobot char name is called when an new robot is selected from the list opengl win c opengl win h Source file for the Fl G1 Window Constructor and destructor for the widget Settings for the OpenGL window like background color colormode etc The draw which calls the functions to draw the robot the floor the effector and the trajectory course void IdleCallback for all animations void handle for all I O actions Header file for the declaration reader Header and source file for functions to load new robot data from the architecture file and the data for the trajectories ikp c Source file with the functions for the kinematic engine setting c Source file for all the workspace objects RVS2006 exe Executable file for WIN32 applications sre This directory contains the source files for different functions axes c Provides two functions to draw frames at the base 34 Directory Filename Explanation each joint and the end effector void JwAxes_xyz float len JwColor color void JwAxes_XYZ float len JwColor color light c Source code for all the light settings in the OpenGL scene void JwInitLight Function JwSetColor to change the defined color value in single RGBA values primitives c Source code for all the basic primitives Chapter 4 links Includes files for the fully rendered models links c Functions to check for a fully
35. f the file and folder structure of RVS Hence it is necessary to look for further details elsewhere For the support on libraries used the internet is the first choice Unfor tunately the only way to understand how RVS works is to analyze the source code Below a short overview of the structure of RVS is provided Notation Typewriter Typeface is used for any kind of source code in this document 2 2 The Main Structure of RVS The original RVS is written in C Also every library that is used is written in this programming language The program needs to interact with the X Server This is done using Xlib an X Window System protocol client library Using the functions of Xlib the programmer is able to create a program without knowing the details of the protocol However Xlib is a low level library and it does not provide objects such as buttons menus etc for a Graphical User Interface GUI For this reason another library is needed This second library called Xt Intrinsics and is based on Xlib It provides support for creating and using widgets The programmer uses widgets to build the GUI so that the user can easily interact with the program However Xt does not offer any widgets so again one more library has to be used XForms The Forms Library for X or short XForms is a widget tookit based on Xlib Therefore XForms should run on all systems where an X Window System is installed The main idea as for every toolkit is to create
36. function was not working in RVS and it is still not working in RVS2006 Only an interface for this feature has been created and some old functions were implemented Currently the menu entry for this function is not shown 51 Bibliography 1 Wu C J Angeles J and Montagnier P 1997 Robot Visualization System RVS User Manual Centre for Intelligent Machines CIM Department of Mechanical Engineering McGill University Montr al Qu bec Canada N Fryer B Hartman and J Silverio C J 1997 OpenGL Porting Guide Silicon Graphics Inc C Angeles J and Khan W 2006 The Kinetostatic Optimization of Robotic Manip ulators The Inverse and the Direct Problem Journal of Mechanical Design Tal Angeles J 2006 MECH 577 Optimum Design Lecture Notes Centre for Intel ligent Machines CIM Department of Mechanical Engineering MeGill University Montr al Qu bec Canada 5 van der Zijp J 2005 FOX Toolkit Documentation http fox toolkit org D Kilgard M J 1996 The OpenGL Utility Toolkit GLUT Programming Interface Silicon Graphics Inc 7 Rademacher P 1999 GLUI A GLUT Based User Interface Library http glui sourceforge net 8 Earls C P Spitzak B and Sweet M 2006 FLTK 1 1 7 Programming Manual http www fltk org 9 Angel E 2002 OpenGL A Primer Addison Wesley 10 Angeles J 2006 Fundamentals Of Robotic Mechanical Systems 3rd ed Springer
37. h the DH parameters is required The fully rendered model has to be programmed for each robot individually In order to make RVS2006 operating system independent only cross platform soft ware packages are used The program is written in C C and OpenGL is used for all 3D renderings In combination with the Fast and Light Toolkit RVS2006 is avail able for Microsoft Windows LINUX and MacOS All main features from the original RVS are implemented in RVS2006 Some functions e g reading data from an exter nal floppy disk are no longer required for the software Therefore these parts have not been implemented in RVS2006 The following list includes all features that are available in RVS2006 e Create load a new robot edit an existing architecture e select rendering mode for a robot e choose different end effectors e display frames e set joint limits e load saved postures e control each joint variable individual e cartesian configuration e trajectories on basis of joint variables 50 place obstacles e select different payloads e create a work environment and export OpenGL scene Recommendations for Further Work Although most of the functions work properly the source code still contains some bugs which could not be fixed during this project This has to be done in the future A list of known bugs is provided in Appendix C In the original RVS the Cartesian Trajectory feature was mentioned However this
38. ilable to PC users the program must be ported to a current oper ating system mainly Microsoft Windows and LINUX This leads to the following goals of this project e The development of a new software package which offers the same functionality as the original RVS but available on a usual computer to debug existing features to provide new features Because the whole expenditure of time is not foreseeable at the beginning it is not possible to define specific aims for new features Therefore only a outline is determined which should be processed as time permits programming of new features which weren t included or didn t work probably in the original software implementation of an optimization algorithm e and to provide a complete documentation for programmers to follow The package should offer two important attributes in the end Open source To publish the package as free software therefore no commercial packages should be used e platform independent The new RVS should be available for use on the most common computers If possible it should be programmed completely hardware and operating system independent 2 Overview of RVS 2 1 Introduction An essential initial task in this project is to analyze the original software Unfortu nately the existing documentation is not detailed The RVS User Manual 1 includes some information about software libraries used and a small but incomplete overview o
39. imple window with a button a value output and a callback function include include include include include lt stdlib h gt lt FL F1 H gt lt FL F1_Window H gt lt FL F1_Button H gt lt FL F1_Value_Output H gt Callback function void button cb exit 0 int main Fl_Window My_window Fl_Button My_button Fl_Value_Output My output My window new Fl Window 100 100 180 100 How FLTK works My button new Fl Button 50 10 80 30 exit My button gt labelsize 12 My button gt callback Fl Callback button cb My output new Fl Value Output 75 50 40 30 Output ws My output gt value 42 My output gt labelfont FL BOLD FL ITALIC My output gt box FL PLASTIC UP BOX My window gt end My window gt show return Fl run First all required header files need to be included Before the main routine the func tion void button_cb is defined This is the callback function for the button widget Every time the button is pressed the code in button_cb is executed Callbacks can be assigned to each widget which can change its value like buttons 1 or 0 value inputs or sliders In this example the function just closes the program by executing the exit 0 command However callback functions usually include much more code and execute much more complex operations 10 In the main routine the FLTK window is created It starts with My window n
40. ing only revolute joints 1 Z is the axis of the ith kinematic pair 2 X is the common perpendicular from Z _ to Z If these two axes are parallel then the location of X is undefined Y is defined by the right hand rule 3 a is the distance between Z and Z this is the link lengths 4 bi is the Z coordinate of the intersection of Z with X Parameters b is also called the link offset and can be positive or negative 5 a is the angle between Z and Z measured positive in the direction of X 41 This parameter is called twist angle 6 0 is the angle between X and X measured positive in the direction of Z 41 This angle is called the joint angle Because a robot does not have a n 1 st link these rules do not apply to the last frame Therefore the frame can be defined arbitrarily but its origin is placed at a specific point the operation point P of the end effector In summary the kinematic chain contains n 1 links n 1 frames and n kinematic pairs The three variables a b and a are called the joint parameters and represent the fundamental geometry of the robot The architecture of each link is defined by the set of these parameters They are constant because the architecture of a robot does not change when the robot moves What changes is the joint variable 0 In order to describe the complete architecture and posture of a n link robot 3n joint parameters and n joint variables are needed This
41. m IrisGL to OpenGL was one of the main changes required during the programming However the question can be asked Why write or port RVS primitives when toolkits like GLUT or GLU offer routines to create 3D objects The 18 answer to this simple All the existing robot models use RVS primitives As a result all these files have to be rewritten when other routines are used The porting task itself can be described as a simple change of commands Although this task may seem to be straight forward it is a bit tricky in the end Often the OpenGL Porting Guide 2 can be used to find the new command for an old one This is sometimes not so easy Following three types of porting scenarios were faced Exact Equivalent For some statements the only difference is the notation For example linewidth is the IrisGL call to change the width of a line In the OpenGL it is glLineWidth In this case no further modifications are required Exact Equivalent but with Different Argument List We provide here an example of the porting scenario at hand and a description of how it was handled The OpenGL command glMultMatrix is the equivalent to the IrisGL command multmatrix Both commands multiply the projection matrix by an arbitrary matrix The difference is the way this is managed In IrisGL the matrix values are saved in a 4x4 array and in OpenGL it is saved in a 1x16 array IrisGL ay ag Qa QA a5 a6 07 dg ag Qio d 012 413 G14 015 U1
42. mber of A is given by 1 1 A gt y tr AA tr A A7 1 4 tr A7A tr AT A 8 4 kP A Z Vtr AAT tr AAT 1 tr ATAJt AT A 8 4 For brevity we shall refer to kp A simply as the condition number of A 8 2 3 Concept of Homogenous Space As long as the Jacobian matrix contains entries with nonhomogeneous dimensions the condition number cannot be calculated To solve this problem the concepts of homogenous space and characteristic length are introduced The goal of this con cept is to make all the entries dimensionless The homogenous space is defined as a dimensionless Euclidean space Similar to the Denavit Hartenberg notation frames vectors and distances can be defined in homogenous space With the same rules the homogenous counterparts a b of the DH parameters a and b are defined The two angles a and 9 bear no physical units while the two variables a and b are nothing but length ratios i e S 2 where L is the characteristic length as yet to be defined With the foregoing homoge nous variables the dimensionless counterparts a and T of the vectors a and r are 41 then defined the homogeneous Jacobian Matrix H taking the form H e e ME n 8 5 e X T amp XTa en XT 8 3 Optimization Problem The approach mentioned in the Introduction optimizing the robot dimensions over its architecture parameters and joint variables is adopted here For a n axis robot 4n design parame
43. obot is redrawn immediately in the OpenGL scene After all the modifications have been made the new architecture can be saved Furthermore the save option is deactivated when a fully rendered model for the selected robot is available For a fully rendered model a mere change of the DH parameters would make the full rendering incompatible Full renderings should be edited as discussed in Section 6 3 26 6 2 3 Feature Work Environment Generally every robot is designed for a special family of task e g pick and place operations Furthermore the robot should work in a special work environment To simulate this RVS offers a variety of objects to create a work environment The available list of objects is as follows Table e conveyor e pallet e battery e peg e surface and e fuselage This list could be extended in the future Figure 6 2 shows a pick and place work environment built around a PUMA robot In the following two ways are discussed to create a work environment for RVS Creating a Work Environment at Source Code Level The programming of these object is similar to that of a link of a fully rendered robot model Every object is built from a number of primitives and defined as a new drawing object of the type Thing In the source code a workspace object is than created like a JwPrimitive object A new variable of type Thing is declared the geometric parameters and the color are defined and finally the object is
44. program will set the redraw method for every posture but only the last posture will be rendered Therefore the simulation would show the robot jump from the initial to the final posture The solution to this problem is the idle callback This function is called every time the FLTK program waits for a new event When the idle callback is inside the main FLTK loop FLTK calls the idle callback continuously This feature is used to get background processing done With the Fl add_idle command an idle callback can be added to the program For the RVS project it is initialized when the OpenGL window is created Inside the callback an if statement for each type of animation is defined and hence the source code will be executed when the condition is true Fig 5 1 shows the process inside the idle callback 23 if true statement 1 Souce Code 1 false JT Forward Mode false posture posture 1 true last posture JT Forward Mode false false Update Joint angle Update Obstacle Position Update Slider Widget true Update FI_GI_Window Wait 0 02 sec if true statement X Souce Code X false Figure 5 1 Flowchart IdleCallback 24 6 RVS 2006 6 1 Integrated Development Environment An integrated development environment IDE is a program that assists computer programmers to develop software Usually a source code editor a compiler and or interpreter and a debugger are integrated in those packages
45. public function for every object is declared The main definition is in the primitives source file primitives c Only these functions and the final drawing function can be called from outside this file JwPrimitive JwDefCylinder int n float r float h int mat JwColor c n number of side r radius h height mat material c color 15 Private definition functions for Units For each object a private function is defined which is called by the public function defined earlier The task of this function is to calculate all the required vertices and normals to draw the object Private drawing functions for Units This function is needed to set up all OpenGL commands in order to generate the 3D rendering It uses the calculations of the previous function to set all vertices in the OpenGL scene Draw the Primitive When everything has been defined and calculated the object can be rendered This is managed by calling the JwDrawPrimitive JwPrimitive P function 4 1 2 Creating and Handling RVS Primitives When an object is drawn in the OpenGL scene it is displayed in the base frame by default To build a robot system it is necessary to edit the position and put the object in the right place For this reason some editing primitives translation and rotation are available JwEditTranslate float x float y float z JwEditRotate Angle angle char axis These functions include the OpenGL commands to translate and rotate
46. rawn within must be rendered on a 2D screen for display OpenGL provides these projections Different types of projections can be used for the visualization of the objects As in reality only the objects in focus can be seen and will be displayed on the screen Depending on the position of the light s the objects are fairly bright and colored Direct3D An alternative graphics library could be Direct3D which is part of Microsoft s DirectX API Like OpenGL this library is used to render 3D graphics There fore Direct3D provides many commands to generate 3D objects For this project Direct3D is not a possible choice because it is only available for Microsoft s Win dows operating systems 3 3 Graphical User Interface As explained above a new toolkit is required The old Forms Library for X could not be used in the new software because it is based on Xlib It is connected to the X Window System and therefore it is not a cross platform toolkit The new toolkit should provide functions for the window management the input output routines and it should offer all the needed widgets 2 Cross platform or platform independent software means that the software works on different system platforms e g Linux Unix Microsoft Windows and Mac OS X Choosing the best toolkit is more difficult than it seems Several packages of interest are available over the internet With respect to the project aims the new toolkit should achieve the following
47. s axis of symmetry As a result the two links can only rotate about the foregoing axis with respect to each other Example Journal bearing Sliding Pair This pair also called a prismatic joint allows for a relative pure translation motion This pair contrary to the revolute has no axis only a direction of motion Example Dovetail coupling The kinematic chain can be also of one of two types In a closed chain each link is coupled to two other links This chain is also called a linkage The chain is an open chain when it contains exactly two links that are connected to only one other link Hence a serial robot is an open kinematic chain because the first and the last link are only connected to one other link In robotics the first link is called the base the last link is the end effector 7 2 Denavit Hartenberg Notation For a robotic architecture each link except the base and the end effector lies between two kinematic pairs In order to describe the robot geometry precisely the Denavit Hartenberg notation Denavit and Hartenberg 1955 is introduced All links are numbered from 0 base to n end effector and each pair is defined as the coupling between the 1 st and ith link Next a coordinate frame F Oi Xi Yi Zi is defined which is connected to the i 1 st link Therefore the frames are numbered 36 from 1 2 n 1 Following the rules for the Denavit Hartenberg notation illustrated in Fig 7 1 and assum
48. s displayed on the screen The skeleton mode is the default mode when a fully rendered robot model is not available The program reads the DH parameters for the selected robot from the architecture file and creates the links accordingly A skeleton revolute link is L shaped and is built with two cylinders and one elbow primitives For a straight prismatic link a prism primitive is used Finally the base and the end effector drawings are always the same for a skeleton model Fig 6 5 A little more effort is required to generate the fully rendered model Four steps are required to achieve the task at hand 30 0 Figure 6 6 Model views of REDIESTRO a Fully rendered model b skeleton model 31 1 Architecture File Every model starts with its architecture file which could be generated using an ASCII text editor or the newly implemented function in the program Appendix A shows the complete architecture file for PUMA560 2 Robot File Creating this C language file is the main task to obtain for a fully rendered model It is a file with the same name as its corresponding architecture file Each link is built using several RVS primitives Further the base and the end effector have to be designed with the RVS primitives The result is a file with several combinations of drawing and editing functions For example the first link of the REDIESTRO model Fig 6 6 a uses 10 RVS primitives and 42 editing functions Figur
49. s now explained for the Joint Trajectory feature The saved trajectory file contains several lines with joint angles in the following format 0 1 02 1 03 1 01 2 02 2 03 2 01 3 02 3 For example for the 7 link REDIESTRO robot the file would look like 101 7014 17 6766 98 9590 88 8606 25 0257 119 4901 113 3444 101 6753 17 6985 98 8462 88 9656 25 2299 119 6729 113 5423 101 6438 17 7185 98 7321 89 0719 25 4328 119 8611 113 7414 101 6070 17 7365 98 6165 89 1794 25 6346 120 0545 113 9415 and has depending on the length of the trajectory hundreds of these lines In the end it is up to the user to define how precise the whole trajectory will be and how many postures are saved in the file When the saved file is chosen from the JTraj directory RVS reads all the lines saves the posture in an array and calculates link positions in the Cartesian space for each posture When the user presses the play button for the forward mode the animation starts At a first glance this seems to be a simple task Just one for loop to set the new postures and redraw the model However this is not possible because of the FLTK routine to redraw the OpenGL scene When the redraw method for a widget in this case the F1 G1 Window is called the widget will not be updated immediately The widget is updated when programm enters the FLTK main loop The result for the aforementioned for loop is that the
50. squared for the function will be minimized when its square is minimized Moreover the factor 1 36 can be dropped for it has no effect on the minimum We thus have the new objective function z tr H H tr H H gt min 8 14 which is factored into two functions namley fi tr H H 8 15 fo tr H H 8 16 This leads to the gradient 8 4 1 Gradient of f The gradient of f with respect to a vector x is defined as 5 tr H H tr E H H 8 18 X X which thus leads to a third rank tensor As a means to avoid cumbersome third rank tensors we express the above gradient in the form 0tr H H 0x tr 0H H 0x1 e HTH Otr H z _ tr OH 8 19 Otr HTH 0x tr 0H H 9x1 For each entry of the design vector x a partial derivative of HTH with respect to a scalar has to be calculated which yields a matrix Since the trace of a matrix is a 43 scalar all array entries in eg 8 19 are scalar The product of the two matrices is a square Symmetric matrix i e ele e1 x T e x T Bar ef eg e X r eg X Te H H E 8 20 ese es x rs e x ro ef es es x Ts eg x Te whose entries are all dimensionless whence tr HTH le j2 le x Fill llesll lles x Fell 8 21 Because the 2 norm of the unit vector e is 1 its derivative with respect to any variable vanishes The second derivatives of terms e x r with respect to z are calculated
51. te 0 0 0 0 la len 2 JwEndEditUnit 17 P gt U 1 def cylinder 24 r2 r3 6 mat Grey 0xcc000000 JwBgnEditUnit P gt U 1 JwEditTranslate 0 0 0 0 la r3 12 JwEndEditUnit P gt U 2 def ring 24 r1 r2 r3 mat c JwBgnEditUnit P gt U 2 JwEditTranslate 0 0 0 0 la r3 2 JwEndEditUnit P gt U 3 def_cylinder 24 r3 la mat Grey 0xcc000000 JwBgnEditUnit P gt U 3 JwEditTranslate 0 0 0 0 la 2 JwEndEditUnit return P In the first half of the function the memory for the primitive is reserved JwMalloc and the type is specified P gt type JwMotorT Furthermore all the necessary geo metric parameters for the simpler primitives are calculated The second half contains the definition of these primitives which are defined as four units P gt U of the motor primitive All the required vertices for the OpenGL commands as well as the OpenGL commands themselves will be specified within the functions for the simpler primitive When the JwDraw function is called for the JwMotor primitive the four objects will be rendered on screen 4 1 4 Deleting an Object During the definition process memory space for the different variables and structures is reserved To free this memory space again for example when a new robot architecture is selected the JwFreePrimitive JwPrimitive P function is called 4 2 Porting the RVS Primitives Library Porting the primitives fro
52. ters are available over which the designer can minimize the condi tion number of the Jacobian matrix Three of these parameters do not influence the condition number The remaining 4n 3 design variables are group in a design vector x in the form x d Q1 a2 be a2 0 Am bn MDI 8 6 In this report we restrict ourselves to th robots with six revolute joints which leads to n 6 and hence a 6 x 6 homogeneous Jacobian matrix The optimum design problem is then defined as mink r H 8 7 subject to the constraints lel 1 ZE 2a3 Ti 8 8 e T 0 TQ a vey 8 9 The number of the first set of constraints is n 1 that of the second set is n which leads to 2n 1 constraints for a n joint robot 8 4 Method of Solution In 3 the direct method was used to solve the optimum design problem In this project the application of a gradient method like the Orthogonal Decomposition Algorithm 4 is investigated The problem is defined as f x gt min 8 10 subject to the constraints h x 0 8 11 where i f x V HH tr HHT 1 8 12 42 Vector h includes the left hand sides of constraints 8 8 and 8 9 namely lex 1 len 1 e T 8 13 e T The Orthogonal Decomposition Algorithm requires the gradient and the Hessian of the objective function and the gradient of the vector h For the ensuing derivations the objective function can be simplified For starters this function is
53. the header files for some source files colors h Available color definitions primitives h Type definition for all RVS primitives robot h Structure definition for a link the end effector and the robot rs This directory contains the main source files rs Arch Robot architectures are saved in this directory rs Ctraj Files with the cartesian trajectories are saved in this folder rs Jconfig Posture files for the different robots 33 Directory Filename Explanation rs Jtraj Saved files for joint trajectories An example of such a file is available in Section 5 2 rs Work_ Env The created work area scenes mentioned in subsection 6 2 3 are saved here main c Source code for the main program main function declaration of global variables FLTK main window function gl_win_redraw for the redraw method menu Source code for the menu The menu c file includes one block of functions for each menu entry The main function to create the window for each block should give the name for each function and widget of the block For example the main function to load a new architecture is void arch so all other names should start with arch_ Callbacks are named like the corresponding widget and have the extension _cb Because the file got very large some functions are saved in new files which are named menu_filename c The Function Robot N

Download Pdf Manuals

image

Related Search

Related Contents

  La machine à coudre et à broder polyvalente    JOURNAL n° 20  Radio - Introni.it  User Manual MV1-D1312C CameraLink®Series    MATHC2+ - Mode d`emploi  Intel S5500HCV  

Copyright © All rights reserved.
Failed to retrieve file