Home » Tutorial » Introduction to V-REP (robotic arm)

Login with your Social Account

Introduction to V-REP (robotic arm)


This is a V-REP tutorial to assemble an articulated robotic arm starting from the beginning.

V-REP (Virtual Robot Experimentation Platform) is a Robotics simulator of with a large capacity, features, and APIs (set of functions and methods to be used by other software).

The V-REP Robot Simulator has an integrated development environment (IDE) in which each model or object is based on a distributed control architecture (can be controlled by an own script, a plugin, a remote client application through its API, etc). This makes the software an ideal multi-robot environment simulation platform. The drivers for robots can be written in c/c++, Python, Java, Lua, Matlab or Urbi.

The following list are just some of the applications when using V-REP:
Simulation of automated manufacturing systems.

  • Remote monitoring.
  • Hardware control.
  • Rapid prototyping and verification.
  • Security monitoring.
  • Educational robotics.
  • Product presentation.

V-REP can be used as an individual application (using your IDE) or can be embedded in a main client application. It has an interpreter for Lua (programming language), which makes it very versatile with the ability to combine high functionality and low level control to obtain spectacular results with few lines of code.

Robotic arm links

In order to introduce the different functionalities of the software, we will use a robot arm, which we call Robot UC3M (arm robotic of the Carlos III University of Madrid, by Antonio Castro). It’s a 3D printable robot arm that can be printed at a very low cost, which has been slightly adapted with respect to the original design. After the completion of this tutorial, you will have a better knowledge of the simulator to face the rest of the tutorials. The expected result of this tutorial is shown in the figure:


First of all, start a new session of V-REP. The simulator shows an empty scene by default. V-REP distinguishes two types of geometries, pure and non-pure. The pure geometries are primitive type spheres, cylinders, prisms, etc. that allow us the rapid calculation of collision, so they are better suited for non-rendering purposes. On the other hand, non-pure geometries often have a very high computational cost of collision calculation, since they are composed of facets. However, graphics cards are prepared for this purpose since they have specialized hardware that allows you to work with different geometries and render them, so they will be used for rendering purposes. Therefore, normally non-pure geometries will be used only for rendering (what the user sees), while pure geometries will be used to run own simulator routines such as collisions, dynamics, etc., that the user does not have to see. V-REP has a set of sixteen layers (structured in two rows of eight layers each) in which to locate each of the objects we create. By default the first eight layers are visible (the first row) and for convenience to make an object non-visible we will check its equivalent layer in the second row (the nine to the sixteen layers) and uncheck the corresponding first row layer. An object can be in multiple layers simultaneously. The layers in which an object is visible can be modified within the common object properties, as shown in the following figure and by double-clicking on the icon of the object and pressing the button “Common”.


To generate non-pure geometries, we can either import them or create them. In our case, we import geometries from the STL files that are used to print the UC3M Robot in the files:

In [File, Import, Mesh], select the files (one by one): “eslabon0.stl”, “eslabon1a.stl”, “eslabon1b.stl”, “eslabon3.stl”, “eslabon4.stl”, “eslabon5.stl”, “eslabon6.stl”, “servo1.stl”, “servo2.stl”, “servo3.stl”, “servo4.stl”, “servo5.stl”, “servo6.stl”, “servo7.stl”, “servo8.stl”, “pinza_base.stl”, “engranaje_izquierdo.stl”, “engranaje_derecho.stl”, “dedo_izquierdo.stl”, “dedo_derecho.stl”, “barra_izquierdo.stl” and “barra_izquierda.stl”. Import units are meters and the Z vector points upwards.

Change the name to each imported part to properly identify it. To do this, in the “Scene hierarchy” window, you will see an object with name “STL_Imported”, which if we double click on its name, it will allows us to change it. To position/orient the object in the simulation environment must first select it and then click the icons “object/item shift” or “rotate object/item” object_item_shift_rotate, which can be found on the menu icon on the top.

Import the above mentioned pieces and place them at the position and orientation as indicated in table 1. Parts should be correctly positioned by default, while orientation of each part might depend on the own part geometry. For convenience, after you import each of the pieces, you need to set it by doing [Edit, Reorient bounding box, with reference of world]. After that, all pieces will be in the configuration that we coined as HOME. Make sure that the Static option is enabled, as specified in table 1. To do so, you have to check it within the dynamic properties of the object after you click the button Show dynamic properties dialog within the Scene Object Properties dialog box. Static objects can not be directly actuated through joints controlled by torque/force, indeed, its position and orientation will depend on the position and orientation of other objects. They have no dynamic, i.e. neither mass nor inertia and usually we will use them for non-pure geometry objects, although there may be cases, where we want a pure geometry without dynamic properties. If a joint had to move a dynamic object, then you must have to set it to force/torque mode or check the hybrid mode, although at the moment this is not necessary. Make sure that the position and the orientation are the ones as indicated in table 1.


Table 1. Positions, orientations and dynamic properties of the UC3M robot parts.

Robotic arm joints

The joints may be of type revolution, prismatic or spherical. In our case, every joint of the robot is of the type revolution. To create a joint [Menu Add, Joint, Revolute]. We rename the newly created joint and introduce the name “articulacionX” where “X” is the number of the joint. For convenience the joint name starts from number 1.

Joints 1 to 6 correspond to the joints centered on the servo shafts of the robot arm, while joints of the 7 to 10 correspond to servo 8 and the holes of the left finger of the gripper and joints 11 to 14 are the holes of the right finger (including the right gear). Joints 10 and 14 (but joint 11) correspond to the holes in the pinza_base (connected to the bars). See the figure below for further clarification of name assigned to each of the joints of the gripper.


By default, the joints are in the mode joint force/torque mode, however, for the moment we will use joint is in passive mode for the joints of 1 to 7, since all objects are static.

In 11 joint, the right gear, is a dependent joint of 7 joint, so we will select the joint is in dependent mode and then press the button “Adjust dependency equation” and enter the equation as shown in the following figure. This mode will allow us to simulate the gear mechanism in such a way that the angle of a joint will be replicated by the other.


Joints from 8 to 14 (with the exception of joint 11) will be set to joint is inverse kinematics mode, that will allow V-REP to calculate the orientation that they should have in order to solve the mechanism of the gripper.

In the properties of each joint, Scene Object Properties dialog box, we can also customize its appearance such as the Joint Length and Joint diameter parameters. You can establish such values as specified in table 2. By default the joints appear in the second layer (in the section on the common properties), while for convenience, we will move them to the tenth layer (on the second row).

Table 2 shows the properties that every joint should have, while table 3 shows their position and orientation (check the position and orientation are correct). Properties of joints are located in the dialog Scene Object Properties, being joints of 1 to 8 and joint 12 not cyclic (the Position is cyclic box must be disabled) with the ranges specified in table 2. For joints from 9 to 14 (but joint 12), since they are not motorised or limited by any mechanism, we leave them with the cyclic option enabled.


Table 2. Properties of joints.


Table 3. Positions and orientations of the joints.

In addition to the joints, you need we create objects of type dummy. They are objects whose purpose is no other than the get its position or link them with certain objects. Typically we will use them to calculate the inverse kinematics of robot. We will create four dummy type objects and position them in the two common holes between the “pinza_base” object and objects of bars (two dummies objects on each side) in [Menu Add, Dummy]. Rename the objects dummy to “dummyIzqPinza”, “dummyIzqBarra” for the hole on the left, and “dummyDerPinza”, “dummyDerBarra” for the dummies of the hole on the right. It is important that pairs of dummies (belonging to the same kinematic chain, either left or right) have the same position and orientation. Thus, we need to position dummies on the left in the same position as the joint 10 and dummies on the right in the same position as joint 14.

V-REP allows you to copy the properties of an object from another object. You can, for example, select “dummyIzqPinza” and, while holding the SHIFT button pressed, select the joint object (from which we want to copy the properties). Then, to copy the position property, access the “Object/Item position/orientation” dialog box by clicking on the icon rotation object_item_shift_rotate and press the button “Apply to selection”, as shown in the following figure.


Parent relationship

Now is the time to establish the relationship between links, the joints and the rest of the simulation objects. The base object is the eslabon0, to which we will activate the option Object model is based on the common properties of the Scene Object Properties dialog box. You will see that a dot appears just to the left of the icon in objects that are base models after activation (now when copying and pasting a model based object will also copy all child objects). This will allow to treat all the robot as a single object (i.e.: to facilitate copy between different scenes). The following figure shows the parent relationship between different objects. To make a child child of another object (parent), you simply need to select the child object on its icon, drag it until the parent object and drop it. To undo the parent relationship, repeat the operation, but releasing the object on the main scene.


Expanding pinza_base we have:


In general, in the case of open kinematic chains, we will make links depending on the joint with the same number. The object eslabon0 does not move and therefore (at the moment) does not depend on any other object.

For closed chains cinematic such as the gripper, we will use dummies such as “dummyIzqPinza” and “dummyDerPinza” depending on “pinza_base” and activate the inverse kinematic mode to make sure the chain is properly closed. The dummies of the bar (the other end of the kinematic chain) must be children of the last of the joints.

The gripper mechanism

Now, we will set up the gripper mechanisms, so that VREP calculates the values of the joints (from 8 to 14, with the exception of the 11 joint). The aim is to establish a geometric constrain between dummies objects that we created earlier, so that whatever the value of the 7 joint (associated with the servo 8), VREP should calculate corresponding angles so that the dummies always remain coincident.

Select in the properties of each of the dummies to be linked to to the corresponding dummy and in the drop-down menu “Link type” select “GCS, overlap constraint”. You can observe that in the window “Scene Hierarchy” the dummies are now linked with an arrow’s color (green for the case of the relationship “constraint overlap GCS”).

V-REP allows you to set certain relationships to the calculation of inverse kinematics. At the moment, we will just use the GCS (Geometric Constraint Solver) tool that allows you to set the values of the joints in the case of closed chain mechanisms, as in the case of the gripper mechanism. To access to “Calculation Modules” dialog box, select [Menu Tools, Calculation modules] with “pinza_base” object selected. Among all the options, we will focus, for the moment in the calculation carried out by the “Geometric constraint solver” (see the following figure), by pressing the corresponding button. If you press the button “Insert new object”, we have established the geometric relationship between the objects.


Now, we are ready to simulate the robot. If you press the button “Start / Resume simulation” right in the toolbar at the top, the simulation will start. At the moment, our simulation it does nothing impressive, but at least you have already managed to assemble your first robot in V-REP and learn several basic aspects.

YouTube Preview Image


%d bloggers like this: