23 August 2015

Here is some basic information for getting started with the robot simulator V-REP. Since the organization of their documentation could use some improvement, I’ll go over some of the key links and other important information. It is also worth loading up some of their demo scenes, which you can see with file>open scene... It should default to the folder with lots of examples.

I’ll give a few links to some important parts. Be sure to take note of the icons they have at the top of their page, because they are key to matching up between their interface and what button to actually push.

  • Interface overview
  • calculation properties dialog where their internal inverse kinematics configuration can be configured, for example.
    • script dialog is how you look at what scripting is built into a simulation
    • child scripts are how to manipulate objects in lua, this is the easiest thing to use and can be added by right clicking on an object > add > scripts > threaded child script
  • Full API Function List is the most useful page of all once the basics are covered is the full API function list:

One of the keys to V-REP is child scripts, which you can see the icon for it at the link. Those are the small lua scripts you can modify, plus you may need a one liner in there to activate the remote API.

Interacting with objects in VREP Programmatically

If you’ve used any old GUI systems, you’ll be familiar with the handle system VREP uses. Essentially, physical objects in the simulation can be represented as a string or an integer “handle” which is an index into an internal lookup table V-REP stores. You pass those handles to the VREP API functions to perform a scripted action like changing joint angles on an object.

Remote APIs, MATLAB, Python

This is their page for the remote APIs. I haven’t tried the MATLAB API or any other remote/external API myself. It is also worth noting remote APIs have reduced performance and a reduced set of functions when compared to the lua and C/C++ APIs that I use.

Of the external APIs, if you know python that may also be worth considering over MATLAB because it has an equally complete set of scientific libraries and doesn’t depend on a license. For those using the UR5 robot, I believe the cisst UR5 library is accessible from python although I haven’t used it personally.

Python + Studywolf blog

While not related to V-REP directly, the study wolf blog has a series of FANTASTIC tutorials on kinematics and control in python, with code. The information on that blog is useful for understanding some of the underlying robotics concepts utilized by V-REP. At the bottom of each page on the studywolf blog you can browse more of his articles specifically.

Using V-REP and matlab to simplify coursework

One more interesting link I came across uses V-REP and matlab to simplify coursework called TRS.

lua APIs and matrices

In case it is useful, luamatrix provides a set of pure lua matrix functions. I haven’t tried it but it did take some time to find so I figured I’d share that. Also, How to integrate an external lua library can be found in the V-REP forums.

Scene Hierarchy

The Scene Hierarchy is the list of objects on the left-hand side of V-REP with things that are already in your simulation.

Sometimes there will be a tab indentation of one object to the bottom right of the other, this is particularly obvious when you look at an arm and how all the indentations slant to the right from top to bottom. This Indentation means that the object is represented in the coordinate frame of the parent object, so if you for example rotate the first link of the arm all the child links are moved with it.

I used this in combination with dummy objects for my system. Dummy objects are useful because they provide a physical frame that you can see in the simulation to attach your objects to and move everything relative to. For example with my bone which had an optical tracker fiducial attached, I put a dummy object a position where the fiducials control point is I made the bone a child that so then when I move the bone The optical tracker would detect that and set the position of the dummy the new detected position on the bone with corresponding we move in the simulation to it’s real time position.


Hopefully that is a decent amount of starter info pointing to some of the key items!

blog comments powered by Disqus