Evaluation of Open Dynamics Engine Software
Total Page:16
File Type:pdf, Size:1020Kb
Evaluation Of Open Dynamics Engine Software R.C.Kooijman D&C 2010.022 Traineeship report Coach(es): dr.ir.D.Kostic Supervisor: prof.dr.ir.H.Nijmeijer Eindhoven University of Technology Department of Mechanical Engineering Dynamics & Control Eindhoven, March, 2010 2 Contents 1 Introduction and Overview 5 1.1 Introduction . 5 1.2 Goals and Contributions . 5 2 Introduction to OpenDE 7 2.1 Introduction . 7 2.2 Definitions . 7 2.3 Simulation Environment . 8 2.3.1 Objet Oriented Approach . 8 2.3.2 Users . 8 2.3.3 Wrapper . 9 2.3.4 Open Source . 10 2.4 Simulation Architecture . 10 3 Closer Look at Open Dynamics Engine 12 3.1 OpenDE In Robotics . 12 3.2 ODE Features . 12 3.3 Coulomb Friction model . 13 3.4 EPR and CFM Parameters . 14 3.4.1 Soft constraint and constraint force mixing (CFM) . 14 3.4.2 Using ERP and CFM . 15 3.5 Sources Of Error . 15 3.5.1 Numerical Integration . 15 3.5.2 Degrees Of Freedom . 15 3.5.3 Machine Precision . 16 3.5.4 Friction Model . 16 3.5.5 Solutions to the error problem . 16 4 Simulations 17 4.1 Introduction . 17 4.2 Evaluation Criterium . 17 5 Double Pendulum 18 5.1 Model Description . 18 5.1.1 Deriving the Equations Of Motion . 18 5.1.2 Newton-Euler with Constraints, as Implemented in OpenDE . 19 5.1.3 Integration . 21 5.2 Implementation . 22 5.2.1 Introduction . 22 5.2.2 Particle object . 22 5.2.3 Force object . 23 5.2.4 System and solver objects . 24 3 5.3 Constraint Force . 24 5.3.1 Introduction . 24 5.3.2 Derivation of Constrain Equations . 25 5.3.3 General Case . 26 5.3.4 Feedback Term . 27 5.3.5 Implementation Constrained Dynamics . 27 5.3.6 Rigid Bodies . 28 5.3.7 Linear and Angular Velocity . 28 5.3.8 Force and Torque . 28 5.3.9 Linear Momentum . 29 5.3.10 Angular Momentum . 29 5.3.11 Rigid Body Equations Of Motion . 29 5.4 Quaternion . 30 5.5 OpenDE Implementation . 30 5.6 Matlab Implementation . 31 5.6.1 Robotics Toolbox . 31 5.6.2 Introduction . 31 5.6.3 Implementation using the Robotics Toolbox . 32 5.6.4 Implementation with MEX files . 32 5.7 Comparison of Results . 32 5.7.1 Computation Time . 32 5.7.2 Energy of the system . 33 5.7.3 Accuracy . 33 6 Colliding Pendulum 40 6.1 Introduction . 40 6.2 Collision handling implementation in OpenDE . 40 6.3 Comparison with collision handling as implementation in Matlab . 41 7 Conclusions and Recommendations 44 A Forward Kinematics And DH parameters 45 B Data Processing 47 C OpenDE Pendulum code 49 C.1 pendulum_main.cpp . 49 C.2 pendulum_body.cpp . 53 C.3 pendulum_body.h . 56 C.4 pendulum_par.h . 57 C.5 SinglePendulum.cpp . 59 D Matlab Code 63 D.1 DP_EOM.m . 63 D.2 xD_DP.m . 65 D.3 simDP.m . 66 D.4 DP_RT.m . 67 D.5 SinglePendulum.m . 69 4 Chapter 1 Introduction and Overview 1.1 Introduction Numerous Robocup teams have been using a particular software tool, namely "Open Dynamics En- gine, (ODE or OpenDE in short), to produce simulations of humanoid robots. This tool allows a user to preform rigid body dynamics simulations by simply providing the system’s parameters and initial states, and thus not have to worry about the equations of motion involved. The Dynamics and Control department at the TU/e has no working experience with this tool and therefore has no real knowledge of its exact capabilities and subsequent limitations. This report takes an investigative look into the use of OpenDE, particulary focusing on its use in the field of robotics. The software’s capabilities have been evaluated in comparison to those of Matlab, which is currently the most popular tool for dynamic simulations. 1.2 Goals and Contributions The goals of this internship is to create a better understanding of the OpenDE tool. The capabilities of OpenDE are to be compared to Matlab by means of comparing equivalent models and simulations. In particular, this study aims to evaluates the software’s performance with respect to the following two criteria’s: • Simulation error. As OpenDE implements a certain methodes of numerical integration, it is important to find out how accurately these are able to replicate simulations made in Maltab. • User friendliness. Determine how quickly/easily OpenDE is to learn and then use relative to Matlab from the perspective of an mechanical engineering student. Due to a combination of poor IT skills and poor documentation available, a lot of time and energy was spent just getting the software up and running. To help facilitate future work, comprehensive installation and implementation user guides have been constructed and added to the appendix. These were a written to accommodate for the needs of even the most computer illiterate mechanical engineer around. Initially, this study was to be based on a implementation of Pieter van Zutven’s model of the hu- manoid robot, TUlip created in Matlab[?]. This soon proved to be an overly complex task for the time frame of a short internship. The workload (and model) were simplified to an implementation of the anthropomorphic walker derived in [?] and compared with the matlab model and simulation pro- duced by D.Karssen and M.Wisse. This model was to a large extent implemented revealing a lot about OpenDE’s ease of use. Being pressed for time and needing a completed model to evaluate accuracies of solutions, two simple models were considered, namely a double pendulum and a bouncing ball. 5 Keeping in mind the goals, the main contributions of this thesis can be summarized as: • ’How to’ guides are produced for installation and use. • Basic modeling and simulation principles employed by OpenDE are analyzed in detail. Al- though not explicitly part of the project goals, is was studied in depth to compensate for short- comings in the openDE userguide. • Advantages and disadvantages are discussed, as well as the pitfalls an engineering student is likely to come across when using OpenDE. 6 Chapter 2 Introduction to OpenDE 2.1 Introduction This chapter will gives an overview of basic structure and fundamental principles behind OpenDE. Brief instructions on how to install OpenDE will also be given, along with a discussion on some of the problems which had occurred during that phase. "Physics engine", "Dynamics engine","Physics SDK (Software Development Kit)", " library for simu- lating rigid body dynamics" are some of the descriptions one could come across when reading about OpenDE, meaning more or less the same thing. To prevent confusion, these and other important words and descriptions will first be looked into. 2.2 Definitions There are a view definitions important enough to be mentioned explicitly. As this report is a discussion on modeling Rigid Body Dynamics, we shall look this definition1first. Rigid Bodies Dynamics The study of the motion of a rigid body under the influence of forces. A rigid body is a system of particles whose distances from one another are fixed. The general motion of a rigid body consists of a combination of trans- lations (parallel motion of all particles in the body) and rotations (circular motion of all particles in the body about an axis). Its equations of motion can be derived from the equations of motion of its constituent particles. The first line is the definition of ’dynamics’. The description of ’rigid bodies’ translates to ’undefend- able bodies’. A rigid body model is a simplification of a real body which has finite stiffens between all the the particles, based on the assumption that the deformation is negligible. Weather or not this assumption/simplification can be made depends on three things, namely: • The body (dimension of a body, material stiffness.) • Simulation parameters (excitation force on the body must be below plastic deformation limit, excitation frequency needs to be significantly lower than the body’s first flexible mode... ) • Degree of model accuracy required. The soft, or deformable bodies, for which this assumption does not hold, are modeled with finite ele- ment models and.