If you are getting started with robot control simulations, then you might be interested in using ROS alongside a robot simulator like Coppelia’s V-REP.
ROS (Robot Operating System) is an open source framework for robot software development that allows a great number of executables to run in parallel and exchange data (synchronously or asynchronously). This is an essential capability when simulating or working with real robots, since robot functionalities and tasks (e.g., localisation, object detection, grasping) can be defined as executables that interact with each other.
The RosInterface is a plugin which interfaces ROS and V-REP allowing the user to write algorithms to control virtual robots. The interface was developed by Federico Ferri, and is part of the V-REP API framework.
You can find the RosInterface plugin in the V-REP folder, ready to be used with ROS Indigo. Unfortunately, it does not work with ROS Kinetic, which is why you will need to build the plugin from source. The following tutorial walks you through the manual installation of this interface for ROS Kinetic.
1. Install the required software
Before installing the interface you will need to make sure you have the following:
- ROS kinetic
- C++ compiler
- V-REP Stubs generator (v_repStubsGen)
- Python interpreter (2.7 or greater)
- lxml package for Python
- tempita package for Python
(Note: This tutorial assumes you already have a C++ compiler)
a) Install ROS kinetic and the V-REP Stubs generator’s required software
$ sudo apt-get install -y ros-kinetic-desktop-full git cmake python-tempita python-catkin-tools python-lxml
b) Clone the V-REP Stubs generator
Clone this repository in the directory of your choice.
$ git clone -q https://github.com/fferri/v_repStubsGen.git
c) Add its path to the search path for importing python modules
$ export PYTHONPATH=$PYTHONPATH:$PWD
2. Create a temporary catkin workspace
$ mkdir -p /tmp/quickstart_ws/src
3. Initialize this workspace
$ cd /tmp/quickstart_ws $ catkin init
You should see the following workspace configuration:
4. Clone & build the RosInterface in this workspace
$ cd src/ $ git clone https://github.com/fferri/v_repExtRosInterface.git vrep_ros_interface
Next, build the workspace:
$ catkin build
Your workspace should now look like this:
5. Check that the resulting vrep-ros library is in the devel folder
$ cd ../devel/lib/ $ ls
You should see a library called “libv_repExtRosInterface.so”
6. Source the workspace
$ cd ../.. $ source devel/setup.bash
7. Copy the library in your V-REP installation folder
First, create a variable called “VREP_ROOT” containing the path of your vrep installation folder as follows:
Open the bashrc with gedit:
$ gedit ~/.bashrc &
Add the following line at the end of the file:
$ export VREP_ROOT="/home/user/Software/V-REP_PRO_EDU_V3_3_2_64_Linux/"
Source the bash in the terminal:
$ source ~/.bashrc
Check if the variable is working:
$ echo $VREP_ROOT
Finally, copy the library in the V-REP folder:
$ cp -iv devel/lib/libv_repExtRosInterface.so "$VREP_ROOT/"
8. Run one of VREP’s simulation scenes/models
Open a new terminal and launch roscore:
Open another terminal and launch V-REP:
Finally, use one of the following predefined scenes to check if the plugin is working:
- controlTypeExamples.ttt (focus on the bright red robot)