Mapa De Processos - PMBOK
Trabalho Escolar: Mapa De Processos - PMBOK. Pesquise 862.000+ trabalhos acadêmicosPor: JCKarsten • 14/4/2014 • 1.021 Palavras (5 Páginas) • 424 Visualizações
Robot Simulation in Matlab
This tutorial will discuss some of the basic steps in creating a virtual robot control and simulation environment in Matlab. This tutorial consists of several parts:
1) 3D graphics (drawing robot primitives) in Matlab using the patch command
2) Manipulating these primitives using the transformation operations (rotation and translation)
3) Animating a robot move
4) Path/Trajectory generation
5) Inverse kinematic control of the virtual robot
Part 1: Using 3D graphics in Matlab
Matlab has several convenient tools to create 3D graphics, in general built on window open GL. The command we will use is the patch command. Everything you would ever want to know about patch can be found in the matlab helpdesk. We will use the following form of the patch command to draw and object:
>patch(‘Vertices’,vertices_link1,’Faces’,faces_link1,’faceColor’,[RGB values])
‘Vertices’: vertices_link1 is a matrix that contains all the vertices used to describe the object. The size of vertices_link1 is nx3 where n is the number of vertices, 3 is the number of coordinates for each vertex (x,y,z). Each row corresponds to a vertex and each column to its x,y,z coordinate.
‘Faces’: face_link1 is a matrix that defines each face of the object in terms of the vertices that lie on the face. Each row of this matrix corresponds to a face, the columns contain the vertices that define the face.
‘FaceColor’: gives one means of defining the coloring of the object. It can be in terms of the faces, vertices, etc., or a single overall color (as used here). The examples that follow use a single color defined in terms of RGB values.
Now for an example: First we will create a cylinder to represent the base of our robot. The cylinder will be represented with a certain number of faces defined by a certain number of vertices. It helps to sketch your primitive and label the vertices and faces as in figure 1:
Figure 1: Link 1, a cylinder
This cylinder will be defined in parametric fashion based on radius (r1) and length (l1). The vertices matrix will look something like:
vert_link1=[ r1*cos(0), r1*sin(0), 0
r1*cos(30), r1*sin(30), 0
etc
The faces matrix will look like:
Face_link1=[1,2,3,4,5,6,7,8,9,10,11,12
1,2,14,13,13,13,13,13,13,13,13,13
etc
These are defined in matlab, and plotted using the patch command to yield the following result:
A second link is created, this one looks like a bar with rounded ends, with parameters r2 (end radius), l2 (bar length) t2 (bar thickness) to yield the following result (plotted with the cylinder):
One final note is made in defining these objects. Each object is defined relative to its own frame and has an origin location. Subsequent rotation operations will act on this frame and about this origin. Therefore, locate the origin and z axis of the body to align with a joint that could be envisioned on the body.
An example of object drawing for a cylinder and rounded bar is shown in the attached code, draw_robot.m
Part 2: Manipulating 3D objects in Matlab:
Once the objects are created, they can easily be manipulated by operating on the vertices with rigid body transformations (rotation + translastion). Each vertex (corresponding to each row in the vertex matrix) is operated on. A few lines of pseudo code demonstrating this process follow:
For i=1 to # of rows of vertex_link1
vertex_link1(i,:) = (R *vertex_link_o(i,:)’)’ + d
end
where
...