-
Notifications
You must be signed in to change notification settings - Fork 2
VREP Simulator Usage
Rerun the ansible script
- 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
# 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
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.
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.
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.
Click file -> load model, navigate to NRMC2019/src/description/vrep_models/robot.ttm.
Select the object you want to modify
Select scene object properties
Select show dynamic properties dialog
If you're lazy like me you can have vrep auto-calculate the moments of inertia
Enter the mass manually
Click on scene hierarchy.
There you can select any component of the scene, select the root of the robot tree.
From there click file -> save model as
Make sure the robot hasn't been shifted during your edits, then click okay
Click yes, unless you think you can get a better glamour shot
Navigate back to NRMC2019/src/description/vrep_modesl/robot.ttm, click save
Click on the joint you wish to modify
Select scene object properties
Double check that the mode is set to Torque/Force mode
Click show dynamic properties dialog
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.
Make sure you save when all joints are modified.