Getting Started with the CoppeliaSim Simulator
Now that you have the MR code library, you need the cross-platform CoppeliaSim robot simulator (formerly known as V-REP) to allow you to visualize the motions of robots. You should complete the items on this page before moving on with the rest of the course! Click on any of the images to make them larger.
Note 1: CoppeliaSim is computationally intensive. To minimize power usage, make sure to "pause" or "stop" a simulation when you are not using it.
Note 2: CoppeliaSim evolved from V-REP, which was discontinued in late November, 2019. CoppeliaSim is backward compatible with V-REP simulation scenes. If you have difficulty installing or running CoppeliaSim, and you can't find answers to your questions on Coppelia's forums, you may use any version of V-REP from version 3.4 or later. Any of these is fine for Modern Robotics simulations.
1. Go to http://www.coppeliarobotics.com/ and download and install the free CoppeliaSim edu software for your operating system. If you are having trouble installing, you can look for help on the Coppelia site, read recommendations from other students on the Coursera week 1 discussion forum regarding CoppeliaSim, or even use an earlier version of the software, known as V-REP (version 3.4 or later).
2. Launch CoppeliaSim. On Linux the startup script is coppeliaSim.sh, which you can execute with the command ./coppeliaSim.sh when you are in the directory with the script. On a Mac, if the app crashes on startup, you may have to run
sudo xattr -r -d com.apple.quarantine *
in Terminal in the directory where the coppeliaSim app is.
Experiment with CoppeliaSim. I suggest you choose File > Open scene... and open one of the example "scenes" that comes with the software. CoppeliaSim "scenes" are specifications of environments, robots, and their actions, and when you press the "play" button the simulation begins. Experimenting with these scenes will show you some of the capabilities of CoppeliaSim. For example, you could choose the "motionPlanningAndGrasping.ttt" scene, as shown in the image below. (All scene files end in .ttt.)
- Important note regarding screen resolution: If you find the text and graphics to be too small on a high-resolution screen, you can edit the file "system/usrset.txt" to change the value of the variable "highResDisplay" to 1. On the Mac, this file is hidden in the directory "coppeliaSim.app" (the application you double-click to execute CoppeliaSim). You can see the contents of this directory using the Terminal utility on your Mac. In Terminal, use "cd" to navigate to the folder where coppeliaSim.app is, then cd to the directory "Contents/MacOS/system" to see usrset.txt. (Another way to see the contents of the coppeliaSim package on a Mac is to control-click on the coppeliaSim app in Finder, choose "Show Package Contents," and navigate to the MacOS/system directory to see usrset.txt.)
3. Press the "play" button at the top of the window to see the robots executing motion plans.
4. We will be using several custom scenes in this specialization. You should download the .zip folder from CoppeliaSim Introduction and unzip it. The scenes include: interactive UR5 (Scene 1), csv animation UR5 (Scene 2), interactive youBot (Scene 3), and csv animation youBot (Scene 4). The Universal Robots UR5 is a 6-joint robot arm and the KUKA youBot is a mobile manipulator consisting of a 5-joint robot arm mounted on an omnidirectional robot base with 4 mecanum wheels. "Interactive" means that you can move sliders that represent the joint positions of the robot, and you'll see the robot move in response. "csv animation" means that the scene expects you to provide a "comma-separated values" (csv) file. A row of the file is a set of joint values, separated by commas, corresponding to the configuration of the robot at a particular instant. Subsequent rows are the configuration of the robot at later times, and the csv file is played as an animation by CoppeliaSim.
Included in the .zip folder are the scene files themselves as well as example input files for some of the scenes. You should make sure your unzipped folder is in a convenient, memorable location on your computer, as you will have to type in the full path to the input files when you use them in the CoppeliaSim scenes that require them.
5. If you currently have a simulation running in CoppeliaSim, press the "stop" button to stop it. Then choose File > Open scene... and open the interactive UR5 scene (Scene1_UR5.ttt) you downloaded. Press the "play" button, choose the "Joint Angle Sliders" tab, and experiment with moving the sliders to see how the joints move.
6. Open and run (press "play") the youBot csv animation scene (Scene4_youBot_csv.ttt). Load the example .csv file for the youBot. You will have to provide the full path to the file; in the example on the Mac below, the path is "/Users/kevin/V-REP_scenes/Scene4_example.csv". After clicking "Open File," press the "Play" button just below where you entered the file path. You should see the mobile robot continually executing the trajectory encoded in the .csv file.
The first line of the .csv file is
where the comma-separated values represent: phi angle of mobile robot base, x position of mobile robot base, y position of mobile robot base, joint1, joint2, joint3, joint4, joint5, wheel1, wheel2, wheel3, wheel4. The angles of the wheels are included so you can see the wheels rotating as the robot moves.
- Important note regarding csv file format: The example csv files included for use with the csv scenes assume that periods, not commas, are used as decimal points. So pi is written as 3.14, not as 3,14. If you are using Linux and your region settings are set to a region that uses commas as the decimal separator, one solution, suggested by a Coursera student, is to invoke CoppeliaSim using US English settings:
- Another option, also suggested by a Coursera student, is to open your Linux "System Settings" -> "Language support" -> "Regional Formats" tab. After changing the region to "English (United States)", log out and back in for the change to take effect.
7. During this specialization, you will have to generate videos of CoppeliaSim visualizations. We have found it easiest to use screenshot-video tools for your operating system. On the Mac, you can use Quicktime to record videos from the screen. On Linux, you can use SimpleScreenRecorder or recordMyDesktop, for example. On Windows, you can use Screen Recorder.
CoppeliaSim provides its own tool, which you can find at Tools>Video recorder. You may need to stop the current scene to be able to configure the video recorder. You can find more information on recording CoppeliaSim movies here: http://www.coppeliarobotics.com/helpFiles/en/aviRecorder.htm.
According to one Coursera student who initially had trouble with CoppeliaSim's video recorder:
I had an issue with integrated video recording. The error was "The video compressor failed initializing." It was resolved by switching output format from default "AVI/H.263+ / H-263-1998 / H.263 version 2" to "AVI/MPEG-4 part 2".
Try recording and saving a 10 second movie of the youBot animating the example .csv file. Your video should be of reasonable quality, but the compression should be such that the video doesn't use too much memory. For example, a few MB is a reasonably sized short video.
When you're finished with the tasks above...
Congratulations! Your MR code library and the CoppeliaSim simulator are ready to use. Do not move on to the rest of the course until these are working for you.
In this specialization we will mostly be using CoppeliaSim to visualize the motion of robot arms and wheeled mobile robots. For example, we use CoppeliaSim to animate your solutions to inverse kinematics, to display the dynamic motion of a robot arm according to dynamics calculations that you will write, to animate the results of path planners you develop, and to simulate a mobile manipulator manipulating an object.
The Modern Robotics specialization does not teach how to use CoppeliaSim in detail, and it uses only a small fraction of CoppeliaSim's capabilities. If you want to learn more, you can find links to documentation at the bottom of this page.