Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

VREP Simulator Usage

Jacob Huesman edited this page Oct 24, 2018 · 6 revisions

Setup

Automatic

Rerun the ansible script

Manual

  • Download vrep
  • Extract it to a folder that you don't mind cd-ing into all the time (base of NRMC2019)
  • Link the vrep_plugin
    ln -s /home/<username>/NRMC2019/devel/lib/libv_repExtNRMC2019Plugin.so NRMC2019/vrep/
    you need to use the full directory path for the first argument

Simulation

Startup

# Launch roscore server
roscore   

# Launch vrep simulator (don't include -h option if you want to see the robot in vrep)     
cd vrep
./vrep.sh -h 

# Launch remote control example
roslaunch vrep_plugin simulator.launch

# Launch rviz (will need to add model, tf, map, etc plugins for viewing stuff)
rviz

Interacting with the simulation

There's a few topics and services for directly interacting with the simulation, these include:

# Services
/vrep/start
/vrep/pause
/vrep/stop
/vrep/shutdown
/vrep/spawn_robot
/vrep/spawn_robot_random

# Public Topics
/tf
/clock

# Private Topics
/vrep/x_y_wheel/*

There's also a real time parameter that's enabled by default, but could be disabled if there's a need for running through simulations faster on a beefy computer.

Performance issues

If the simulator is using up a ton of your computer's resources, it may be a bug in how the viewer renders on certain graphics cards. If you run the simulator headless and use rviz to view the robot instead, it may perform better. This year I enabled a sim time, so even if the simulation isn't able to run in real time, the other packages should slow down as well to match. You have to use the ros time api though in order for it to work with your packages.

Modifying the model

Load the model in a new scene, DON'T MODIFY THE MAIN SCENE

That would mess up the vrep plugin. Instead open up a new vrep scene, and then load the model from NRMC2019/src/description/vrep_models/robot.ttm. Make sure you don't move the model from the origin, this will cause it to load with an offset. model01 Click file -> load model, navigate to NRMC2019/src/description/vrep_models/robot.ttm. model02 model03

Modifying the physical properties of a model component

Select the object you want to modify model04 Select scene object properties model05 Select show dynamic properties dialog model06 If you're lazy like me you can have vrep auto-calculate the moments of inertia model07 model08 Enter the mass manually model09 model10

Saving the robot

Click on scene hierarchy. model11 There you can select any component of the scene, select the root of the robot tree. model12 model13 From there click file -> save model as model14 model15 Make sure the robot hasn't been shifted during your edits, then click okay model16 Click yes, unless you think you can get a better glamour shot model17 Navigate back to NRMC2019/src/description/vrep_modesl/robot.ttm, click save model18

Modifying joint dynamic properties

Click on the joint you wish to modify model19 Select scene object properties model20 Double check that the mode is set to Torque/Force mode model22 Click show dynamic properties dialog model21 Target velocity is set with the plugin api, so don't change it. I haven't figured out how to set the max torque programmatically, so this has to be updated manually through these dialogs. model23 Make sure you save when all joints are modified.