V-REP Introduction

From Mech
Jump to navigationJump to search

V-REP Introduction

On V-REP's homepage the program is described as

  ...the Swiss army knife among robot simulators: you won't find a simulator with more functions, features, or more elaborate APIs.

V-REP's strength comes from several features:

  1. V-REP provides a unified framework combining many powerful internal and external libraries that are often useful for robotics simulations. This includes dynamic simulation engines, forward/inverse kinematics tools, collision detection libraries, vision sensor simulations, path planning, GUI development tools, and built-in models of many common robots.
  2. V-REP is highly extensible. V-REP developers provide an API that allows one to write custom plugins that add new features. You can embed Lua scripts directly into a simulation scene that, for example, process simulated sensor data, run control algorithms, implement user interfaces, or even send data to a physical robot. They also provide a remote API that allows one to develop standalone applications in many programming languages that are able to pass data in and out of a running V-REP simulation.
  3. V-REP is cross-platform, mostly open-source, and provides a free educational license.

The purpose of this page is not to teach you how to use V-REP. Rather it is to describe several demonstration scenes that have been developed to help visualize robot arm kinematics. If you are interested in learning more about V-REP, check out the Useful Resources section below.

Demonstration V-REP Scenes

To run either of the scenes below, the first step will be to download V-REP for your operating system. You should download the latest Non-limited EDUCATIONAL version. Next you will have to install V-REP. On Windows, you simply have an EXE that installs V-REP. On a Mac, you first need to unzip the download. The directory that is produced by unzipping the download contains a vrep.app directory that should allow you start V-REP through normal mechanisms e.g. Finder/Spotlight/Launchpad. On Linux, you will need to extract the compressed tar archive (e.g. using a command like tar xvf V-REP_PRO_EDU_V3_3_2_64_Linux.tar.gz). Then you need to change directories into the V-REP source directory and run the vrep.sh shell script.

Once V-REP is open you will want to run one of the scenes below. To run either of them, you first run V-REP, then you click File->Open scene... and open one of the ttt files that are linked below. Then click either the Play button from the top toolbar or click Simulation->Start simulation and a GUI should pop up. Clicking the Stop button or Simulation->Stop simulation will close the GUI and stop the simulation.

The scenes below are implemented similarly. They both feature a simulation of a kinematically-controlled, non-respondable UR5 robot from Universal Robots. By kinematically controlled I mean that all dynamics (inertias, torques, friction, etc.) of the system are neglected. We can specify a set of joint angles and the simulation is capable of instantaneously "teleporting" the robot to be at the new set of joint angles. By non-respondable I mean that the links of the robot are not capable of interacting with the world or each other through collisions. In other words, we can put the robot in configurations that result in self-collisions, but the simulation will ignore the collisions. The physical UR5 robot features 6 joints each with 720 degrees of rotation, and this simulated robot has the same joints and limits. The model of the UR5 in each of the scenes was created by importing a URDF from the ROS-Industrial ur5_description package.

In each scene, there is a single Lua script called a Non-threaded child script. When the scene is first run, there is a function that is called that sets up the GUI and creates variables that are going to be needed later on in the simulation. Then during every step of the simulation the main script, which is part of every V-REP scene, runs an "actuation" function from the child script. This actuation function is responsible for processing all of the changes to the GUI since the last time it was called (buttons clicked, label updates, etc.), and for sending joint commands to the simulated robot. Technically, there is also a "sensing" function in the child script that gets called by the main script, but in each of these demos, the sensing function is empty. The GUIs are both built with V-REP's Qt-based custom UI framework.

Interactive UR5

In this demo, the GUI features two tabs. One tab lets you drag sliders to modify the joint angles of each joint, and the other tab allows you to specify comma-separated angles for all 6 joints in an editable text box and ask for the transformation from the base frame to the end-effector frame. The frames attached to the base and end-effector are persistently displayed (x-axis in red, y-axis in green, z-axis in blue). Note that all angles are specified in radians.

CSV Animation UR5

This demo allows you to specify a CSV file containing a trajectory of joint angles, and then animate this trajectory. Each column of the CSV file is the joint angle through time for one of the joints (first column is joint 1, last column is joint 6). In other words, a single row of the CSV file represent a complete configuration of the robot at a particular time. The assumed timestep between rows is equal to the timestep that V-REP uses for simulation; the default is 0.05 seconds. Note that will need to provide a complete path to your CSV file. Alternatively, you may be able to provide a relative path, but you'll need to figure out what V-REP uses as its base directory on your OS. On Linux, this directory is the root directory of the V-REP source code. If you figure out this directory, you could also move your CSV files to be in this directory and just reference them by name without specifying the path at all.

Useful Resources