A robot is made of one or several bodies linked by some joints. In
Move3D, a body is the same kind of object than an obstacle. The
description of a robot always starts by the function
p3d_beg_desc(P3D_ROBOT, robot_name). The function p3d_beg_desc
checks again if the description of an environment has been started, if we
are not describing an obstacle or another robot at the same time and
calls the function void *p3d_beg_rob(char *name)
with the name
robot_name. The function p3d_beg_rob allocates an robot structure
p3d_rob (cf Annex ) of name robot, initializes
it stores it as the current robot, and returns it as an output.
Once the robot has been initialized, we can start its geometrical and cinematical description.
A robot can be seen as a kinematic chain (a tree) on which some polyhedral bodies are
placed (cf Fig. ) but it can also be seen as a ``game
of construction'' : we create a body, we attach a joint on this body
and then place another body on this joint, and so on.
The description of a body starts by the function p3d_beg_desc(P3D_BODY,body_name). The function p3d_beg_desc checks if the description of an environment and of a robot have been started, if we are not describing another robot or obtsacle at the same time, and, as a body is the same type of object as an obstacle, it calls the function void *p3d_beg_obj(char *name, int type) with the name body_name and the type P3D_BODY as inputs. The description of a body of a robot is the same as the description of an obstacle, but with some slight differences.
Inside p3d_beg_obj, there is no difference : the object is allocated, initialized and stored as the current object. But inside p3d_end_obj, the current object is not stored in the array of obstacles of teh environment, but in the array of bodies of the robot. If the body described is the first body of the robot, p3d_end_obj also creates automatically the joint 0 of the robot, j0. The joint j0 is a special joint : it allows the robot to translate along the x, y and z axis and to rotate around the z axis. It is always defined at the point (0,0,0). And this induces the main difference between the description of an obstacle and the description of a robot : an obstacle can be described in his place in the environnement but a robot must be described regarding the point (0,0,0). The description of a body ends with a p3d_end_desc.
A joint is added with the function :
int p3d_add_desc_jnt(int type, double x0, double y0, double z0, double axe1, double axe2, double axe3, double v, double vmin, double vmax, int prev)
The type TYPE can be P3D_ROTATE (for a rotoid joint) or
P3D_TRANLSATE (for a prismatic joint). The triplet (x0,y0,z0) is
the point where the two bodies will be linked and the vectore
(axe1,axe2,axe3) is the axis of rotation or translation of the
joint. The interval [vmin,vmax] is the bounds of the joint and v its
current value. Finally, is the number of the previous
joint of the described joint on the cinematic chain.
It checks if a description of a robot has been started, if we are not describing an obstacle at the same time, allocate the joint, initializes it and updates the informations of the cinematic chain (the set of next joints of the rpevious joint for example), stores it in the array of joints of the robot, and returns the new number of joints of the robot.
The description of a robot ends by a p3d_end_desc that calls the function int p3d_end_rob(void) . The function p3d_end_rob updates the bounding box of the robot, and finishes the initialization.
Figure:
Description of a scene in Move3D.
Once all the obstacles and robots have been described, the description of a scen ends by a last p3d_end_desc. But to be complete, a scene must also use the functions p3d_set_env_box (defines the limits of the scene), p3d_set_robot_box (defines the bounds of j0), p3d_set_robot_radius (define the radius of the turning circle of the robot) and p3d_set_robot_pos (defines the current values of the degrees of freedom of j0) that will be described in the following chapters.