1、从github上下载源码zip包
https://github.com/HemaZ/FastRTPS-ROS2
<<FastRTPS-ROS2-master.zip>>
2、将zip包放到~/Fast-DDS/Fast-DDS/example/cpp/dds/下,即HelloWorldExample相同路径下
3、解压FastRTPS-ROS2-master.zip到当前路径
4、进入解压后的文件夹内
cd FastRTPS-ROS2-master/
5、新建build文件夹并进入build文件夹
mkdir build && cd build
6、设置环境变量
echo 'export LD_LIBRARY_PATH=/home/yl/Fast-DDS/install/lib' >> ~/.bashrc