Communication implementation of ROS Melodic+Coppeliasim V4.5.1 under virtual machine VMware Ubuntu18.04

Related configuration: Virtual machine VMware 16 Pro

ROS version: melodic

Ubuntu version: 18.04

Coppeliasim version: V4.5.1 (edu version); download link: https://www.coppeliarobotics.com/downloads

For part of the content, refer to CaoDong street  ! and CoppeliaSim study notes of CoppeliaSim Edu V4.1.0 + Ubuntu 16.04 + ROS Kinetic environment construction and basic testing_coppeliasim 4.1 edu_Tom and Beta's blog-CSDN blog

1. Create a workspace

mkdir -p catkin_demo/src ##创建工作空间

Due to the characteristics of the new version of Coppeliasm, sim_ros_interface and ros_bubble_rob have been built into the software package. There is no need to download the corresponding configuration package in the workspace. Therefore, you only need to import the coppeliasim software package into src in the workspace.

Download the corresponding Linux version through the link above, and you will get a file with the suffix tar.xz. Unzip it to the workspace src. First

cd catkin_demo/

cd src/

cd CoppeliaSim_Edu_V4_5_1_Ubuntu18_04/  #此处文件夹名称会有出入

./coppeliaSim.sh    #运行coppeliasim,测试是否成功

#  Crtl + C 退出


2. Download the corresponding Cmake version (>=3.16)

cd /usr/src

sudo wget http://www.cmake.org/files/v3.16/cmake-3.16.6.tar.gz

sudo tar xf cmake-3.16.6.tar.gz
    
cd cmake-3.16.6
    
sudo apt-get install build-essential 
    
cd /usr/src

sudo chmod -R 777 cmake-3.16.6

cd cmake-3.16.6
    
sudo ./bootstrap
    
sudo make
    
sudo make install
    
cmake --version

3. Install python 3.X

Note: If a virtual environment such as Anaconda is installed, opening the terminal will automatically appear (base), which is the Python version in the virtual environment. Run conda deactivate to exit the virtual environment.

# 在安装前先在根目录下运行python--version 查看当前python版本

sudo apt install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt install python3.8

python3.8 --version

4. Install catkin tool

sudo apt install python3-catkin-tools python3-osrf-pycommon

5. Compile

sudo apt install xsltproc #下载xsltproc软件

sudo gedit ~/.bashrc 

# 在~/.bashrc末尾添加:

export COPPELIASIM_ROOT_DIR=/home/b/catkin_demo/src/CoppeliaSim_Edu_V4_5_1_Ubuntu18_04 ##导入CoppeliaSim路径

catkin build -j4 ##编译

6. Operation

# 先运行roscore,再运行Coppeliasim

roscore

# 参考之前的步骤,运行

./coppeliasim.sh

# 查看ros节点

rosnode list

# 运行出来会有如下显示:

/rosout

/sim_ros_interface

In addition, you can also directly refer to the official website help documentation to connect ROS and CoppeliaSim . At this point, the basic configuration of the bridge between ROS and CoppeliaSim is completed. You can open the ROS-related scenarios provided by CoppeliaSim for testing.

7. Basic test

The ros scene that comes with CoppeliaSimrosInterfaceTopicPublisherAndSubscriber.ttt,文件位于(/home/b/catkin_demo/src/CoppeliaSim_Edu_V4_5_1_Ubuntu18_04/scenes/messaging)

 

rostopic list

出现了topic /image,使用命令:

rosrun image_view image_view image:=/image  #查看摄像头图像

 

 The test of publishing camera image data by CoppeliaSim was successful

Guess you like

Origin blog.csdn.net/cz_include/article/details/131282046