1.安装前提
- 安装ROS2(省略)
- Cyclone DDS到**/opt/cyclonedds**
- 安装performance_test工具
2.安装Cyclone DDS
参考教程:https://github.com/eclipse-cyclonedds/cyclonedds
安装DDS需要以下条件:
C compiler (most commonly GCC on Linux, Visual Studio on Windows,
Xcode on macOS);
Optionally GIT version control system;
**CMake**, version 3.16 or later;
Optionally **OpenSSL**, preferably version 1.1;
Optionally **Eclipse Iceoryx** version 2.0 for shared memory and
zero-copy support;
Optionally **Bison parser generator**. A cached source is checked into the repository.
我的电脑里自带的CMake及OpenSSl版本正好对应上了,就没装,直接装的Eclipse Iceoryx和Bison parser generator,参考教程:https://iceoryx.io/latest/getting-started/installation/
2.1安装 Eclipse Iceoryx
安装依赖的工具包
sudo apt install gcc g++ cmake libacl1-dev libncurses5-dev pkg-config
通过git获得iceoryx
git clone https://github.com/eclipse-iceoryx/iceoryx.git
生成build文件
cd iceoryx
cmake -Bbuild -Hiceoryx_meta
# when you have installed external dependencies like ncurses you have to add them
# to your prefix path
cmake -Bbuild -Hiceoryx_meta -DCMAKE_PREFIX_PATH=$(PWD)/build/dependencies/
使用cmake编译源码
cmake --build build
安装到系统
sudo cmake --build build --target install
2.3 安装Bison parser generator
apt install bison
2.4 安装Eclipse Cyclone DDS
git获取文件
git clone https://github.com/eclipse-cyclonedds/cyclonedds.git
cd cyclonedds
mkdir build
接下来比较坑,对应原文的
这上面是要配置的一些参数(不配置下面生成的DDS生成会出现一些问题)每个配置的命令格式为(用第一个举例子) cmake -DBUILD_EXAMPLES=ON ..
但会有几个有特例,第二个命令cmake -DBUILD_TESTING=ON ..
在运行之前要在电脑上安装CUnit,参考文章CUnit,然后第三个命令不要运行(cmake --DBUILD_IDLC=NO ..
),这个命令要是运行了,后面的都运行不了(在我电脑是这样的),如果运行了可以把NO变成ON运行,后面的参数按照上面的格式依次运行,这个 --DBUILD_IDLC一直等于NO就可以(后面没啥影响)。
配置build路径,运行
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/cyclonedds/ ..
cmake --build .
安装
cmake --build . --target install
安装成功后会在/opt/cyclonedds/下出现
/opt/cyclonedds/lib
/opt/cyclonedds/bin
/opt/cyclonedds/include/ddsc
/opt/cyclonedds/share/CycloneDDS
看到出现这个DDS应该安装的差不多
3.安装performance_test
先启动ros2服务(如果装的是foxy版本或者其他版本,将rolling变成foxy)
source /opt/ros/rolling/setup.bash
mkdir -p ~/perf_test_ws/src
cd ~/perf_test_ws/src
git clone https://gitlab.com/ApexAI/performance_test.git
cd ..
# At this stage, you need to choose which middleware you want to use
# The list of available flags is described in the middleware plugins section
# Square brackets denote optional arguments, like in the Python documentation.
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DPERFORMANCE_TEST_CYCLONEDDS_ENABLED=ON
source install/setup.bash
这里colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DPERFORMANCE_TEST_CYCLONEDDS_ENABLED=ON
会出现问题,是因为终端没有代理,即使网页有代理终端也不会有代理,参考我发的文章即可。
在运行source install/setup.bash
时,也会出现问题,如./tests: error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory
,这里需要找到你所缺少的libraries: xxx.so.0,在linux里搜索这个文件,找到他所属的路径,然后将这个路径加到/etc/ld.so.conf
里,具体参考文章:https://blog.csdn.net/vitaminc4/article/details/78707198。