CoppeliaSim - gkgkgk1215/else GitHub Wiki

Install CoppeliaSim

Download the latest ver. https://www.coppeliarobotics.com/downloads

Download previous of the sim https://www.coppeliarobotics.com/previousVersions

3 lines in the bash file:

export COPPELIASIM_ROOT=/home/minho/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT
export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT
source ~/.bashrc

If you want to continue to use CoppeliaSim Edu V4.1.0 past July 2021, then simply add following in the system/usrset.txt file: allowOldEduRelease=7501

If you want to continue to use CoppeliaSim Edu V4.2.0 past April 2022, then simply add following in the system/usrset.txt file: allowOldEduRelease=7775

https://forum.coppeliarobotics.com/viewtopic.php?f=9&t=9334

Remote API

conda activate minho
pip install pyzmq
pip install cbor
  • Copy all files in the path /home/minho/CoppeliaSim_Edu_V4_3_0_Ubuntu20_04/zmqRemoteApi/clients/python to the project folder.

Install V-REP simulator

  • Download VREP "Edu" and extract: Link
mv ~/Downloads/CoppeliaSim_Pro_V4_1_0_Ubuntu20_04 ~/VREP
echo "export COPPELIASIM_ROOT_DIR=/home/hwangmh/VREP/" >> ~/.bashrc
source ~/.bashrc
  • Download models and scenes for dVRK
git clone https://github.com/unina-icaros/dvrk-vrep.git
cd dvrk-vrep
mv V-REP_models/ dvrk_models/ && mv dvrk_models/ ~/VREP/models/
mv V-REP_scenes/ dvrk_scenes/ && mv dvrk_scenes/ ~/VREP/scenes/

dvrk_scene for UCB setting can be downloaded here(with background) or here (with white background)

Install libPlugin

git clone https://github.com/CoppeliaRobotics/libPlugin.git
cd libPlugin/
cp * ~/VREP/programming/libPlugin/ -rf

Install ROS Interface

sudo apt-get install python3-pip
pip3 install xmlschema
sudo apt install xsltproc
cd ~/catkin_ws/src
git clone --recursive https://github.com/CoppeliaRobotics/simExtROSInterface.git sim_ros_interface
cd ~/catkin_ws && catkin build

Publish topics for setup joint

  • Open the sim and insert the following lines in the "proper" position of the child script.
  • At the beginning,
function set_position_joint_callback(msg)
    --if (msg.position[1] ~= nil) then
        
        sim.setJointPosition(RJ1,msg.position[1])
        sim.setJointPosition(RJ2,msg.position[2])
        sim.setJointPosition(RJ3,msg.position[3])
        sim.setJointPosition(RJ4,msg.position[4])
        sim.setJointPosition(RJ5,msg.position[5])
        sim.setJointPosition(LJ1,msg.position[6])
        sim.setJointPosition(LJ2,msg.position[7])
        sim.setJointPosition(LJ3,msg.position[8])
        sim.setJointPosition(LJ4,msg.position[9])
        sim.setJointPosition(LJ5,msg.position[10])
        sim.setJointPosition(CJ1,msg.position[11])
        sim.setJointPosition(CJ2,msg.position[12])
        sim.setJointPosition(CJ3,msg.position[13])
        sim.setJointPosition(CJ4,msg.position[14])
    --end
end
  • At "sim_call_type==sim.syscb_init",
subJoints = simROS.subscribe('/dvrk/setup_joint/state_joint_desired', 'sensor_msgs/JointState', 'set_position_joint_callback')
  • At "sim_call_type==sim.syscb_cleanup"
simROS.shutdownSubscriber (subJoints)