• No results found

Multibody Animation

In document Wright Jaron - Computer Animation (Page 79-84)

2 3D Modelling in Augmented Reality

3. Simulating and Animating in AR

3.1. Multibody Animation

With multibody simulations engineers analyze the kinematics and dynamics of moving parts and linkages. Starting from the knowledge of mass and inertial properties of each component, topological constraints (joints and fixtures) and external actions (forces, torques, motors), it is possible to simulate the movement of a system in a reliable way. Readers interested in techniques for deducing the governing equations and solution strategies can refer to referenced books [30-31]. The AR can support multibody simulations in two different ways. The first is about the possibility to project on the real world the results coming from a pre- computed simulation. It concern the rendering on the scene of all the objects involved in the simulation, whose position is updated according to the results of the computation. This implementation is similar to that of the common post processing software for visualizing graphics results. The only difference lays in the merging of the simulated system in the real

world. The advantage is to perceive the interaction with the real world and check working spaces, possible interferences, etc. Although useful, this approach does not use all the potential of AR. Let us consider a practical application in order to illustrate this first possible integration between motion simulation and augmented reality. The purpose is to simulate a robot that has to be mounted on flange by means of a revolute joints. The flange is present in the real world as a physical component (Figure 10). The robot and its movement have to be added as virtual shapes. The first step is to built the virtual parts. This task can be done using the modeling techniques illustrated in the previous section or also using a computer-aided design program. In this case it is useful to export geometries using .vrml (Virtual Reality Mark-up Language) file. This format is quite common and can be exported by almost all solid modelers. Dealing with .vrml is useful for rendering geometries using OpenGL libraries. The second step is to perform the numerical computation using a specific solver. In order to prepare the input file for simulation, it is useful to consider how to relate the real world to the virtual world. The main issue is to collimate the two main reference frames. This operation can be made using communication reference frames in the same way of sub-structuring large assemblies. In other worlds, we can consider the virtual world (and the objects in it) as a subsystem of the real world. The relation between the main system and a subsystem is controlled by several constraint equations acting on the communication reference frames. For the specific example of the robot, it can be convenient to locate the real world communication frame on the flange when the revolute joint has to be implemented. Similarly, we can define the virtual communication frame coincident to the inertial reference frame of the virtual system. When building the equations for simulation, we have to create a fictitious revolute joint between the virtual inertial reference frame and a reference frame on the first link of the robot. This approach can be resumed in the following five steps:

1. Before the simulation starts, the geometries and topological properties (joints and connections) have to be defined, built and stored in files;

2. The real scene has to contain information for collimating the real world to the virtual objects (communication frames);

3. The equations of motion of the investigated mechanisms have to be built and externally solved by means of a specific solver;

4. After the numerical solution, simulation results have to be accessible to AR executable.

5. Each frame acquisition, virtual objects have to be rendered on the scene in the correct position and attitude according to the simulation results, considering the position of the communication frames and using OpenGl ModelView transformations.

The definition of the real world reference frame can be done in two different ways. In the first, the patterned marker can be placed on the flange where the communication frame is desired (Figure 10). The second way is about the picking of points defining the communication frame by the use of I-Pen and recording the coordinates of the origin and main axes.

As a result, the augmented scene includes the real world with the virtual robot. Since the movement of the manipulator has been simulated solving the equations of motion, the augmented scene will show an animation of the robot. By this way the user can visualize from different points of view, the motion of the manipulator directly in the real world looking at its

performance, verifying working space, checking possible interference with real objects and the aesthetic impact on the real environment.

The augmented video can be enriched with other visual information on kinematic and dynamic parameters as velocity, acceleration, force, torque, joint reaction, etc. This can be performed rendering on the scene both vectors (for the direction) and numerical values (for the amplitude) as static overlays.

A smarter way to enhance the multibody simulation is to introduce interactivity. It means that the user does not only watch the augmented scene, but interact with it. Let us imagine the kinematic simulation of a robot arm whose end-effector can be grabbed by the user and moved. The purpose of the simulation is to compute attitude and position of all the links in order to obtain the required position and orientation of the end-effector. This simulation can be supported by augmented reality by introducing in the real scene the virtual robot that can be interactively manipulated by the user using virtual sensors. Of course, the simulation of the mechanism has to be computed real time in order to update the scene with quick information. This idea can be implemented following five steps (Figure 11):

1. Before the simulation starts, the geometries and topological properties (joints and connections) have to be defined, built and stored in files;

2. The real scene has to contain information for collimating the real world to the virtual objects and the virtual sensor(s) for the interactive action of the user;

3. Each frame, the position and attitude of all markers in the scene have to be acquired and mathematical transformations between camera and markers have to be computed.

4. Each frame, starting from the previous recognition and calculation, dynamic or kinematics equations have to be solved in order to compute the correct position and attitude of all the virtual bodies in the scene;

Each frame acquisition, virtual objects have to be rendered on the scene in the correct position and attitude.

Figure 10. Simulation of the movement of a manipulator in augmented reality. Starting from a real environment and adding collimated virtual objects (on the top), an augmented animation can be built (at the bottom).

Figure 11. Activities for implementing interactive simulation in augmented reality.

The input and output procedures (data acquisition, markers recognition, rendering of the virtual objects) can be implemented using the ArtToolkit open source library.

Between the input procedures (data acquisition and markers recognition) and the output procedures (rendering of the virtual objects on the input scene) a specific kinematic or dynamic solution has to be implemented. This portion of the algorithm depends on the specific mechanism to be simulated. Since it has to be performed between the acquisition of two consecutive frames, all the equations need a real-time solution [32-34]. For this purpose it is useful to optimize the solution strategy and kinematics simulations are more suitable

because involve the solution of a system of non linear equations, instead of a system of differential-algebraic equations.

In order to explain in details all the steps to implement a multibody simulation in an Augmented Reality environment we develop an example about a 3D manipulator.

Figure 12. The 3D manipulator of the example, and its closure loop.

With reference to Figure 12, let us consider a robot with 4 bodies connected with 3 revolute joints and 1 spherical joint. According to Grubler’s count the mechanism has 6 degrees of freedom:

(

)

link 1

6

ijoints

6

i

6

where

n

linkis the number of moving parts, joints is the number of kinematic pairs and

f

i are the degrees of constraint of the i-th pair.

It means that, in order to define in a unique way the position in space of the manipulator, we have to prescribe 6 independent parameters (i.e. position and attitude of the end-effector). For an interactive simulation it means that the user can freely choose the position and attitude of the end effector and the Augmented Reality scene has to be able to include such a 6 d.o.f. sensor. This sensor can be represented by a patterned marker.

The first step in building the model is the construction of geometries of each link that can be stored in .vrml (Virtual Reality Mark-up Language) file. This format is quite common and can be exported by almost all solid modelers. Dealing with .vrml is useful for rendering geometries using OpenGL. The second step is about the preparation of the scene. We need a marker (marker 0) to define the position and orientation of the manipulator world coordinate system (i.e. its position inside the scene) and another marker (marker 1) to define the position and the orientation of the end-effector that will work as a sensor (Figure 12, on the right).

The third step is about the implementation of the system of constraint equations which can be built considering the closed loop of vectors (Figure 12, on the right). Several approaches can be used for building the system of equations. It is useful, for the subsequent graphical operations, to use the 4x4 homogeneous transformation matrix

[ ]T

l1l2to express the relative position and attitude between two generic links 2 and 1. The first 3x3 portion of this matrix is used to define the relative orientation between the two reference frames attached to the two links. The last column is used to describe the relative position between the origins of the coordinate frames. The last row of the matrix is [0 0 0 1]:

[ ]

[

]

3x3

[

]

3x1 1 2

Orientation

Position

0

0

0

1

l l

T

= ⎢⎡

Looking at the tip point P on the link 2 (center of the spherical joint) we can deduce its position with respect to the marker 0 as:

{ }P

marker0

=[ ]T

0−l0

⋅[ ]T

l0−l1

⋅[ ]T

l1−l2

⋅{ }P

link 2 (1) where:

{ }P

marker0is the position vector of point P in marker 0 (world) coordinate system;

{ }P

link 2is the position vector of point P in link 2 (local) coordinate system;

[ ]T

0−l0is the homogeneous transformation matrix between link 0 and marker 0. It is a

In document Wright Jaron - Computer Animation (Page 79-84)