首页 > 系统相关 >Ubuntu 18.04安装fast-dds

Ubuntu 18.04安装fast-dds

时间:2022-12-05 11:01:44浏览次数:62  
标签:cmake 18.04 dds Fast cd DDS fast

提纲
1、概述
2、foonathan_memory_vendor
3、fast-cdr
4、fast-dds
5、编译HelloWorldExample
6、安装fast-dds-gen,使用IDL文件构建代码



1、概述

fastdds是干什么,就不重复说了。

操作系统是Ubuntu18.04

本次采用源码编译安装,需要使用到以下的包:
1.foonathan_memory_vendor

2.fast-cdr

3.fast-dds



2、foonathan_memory_vendor的安装

获取foonathan_memory_vendor:

cd ~/Fast-DDS
git clone https://github.com/eProsima/foonathan_memory_vendor.git
mkdir foonathan_memory_vendor/build
cd foonathan_memory_vendor/build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ON
cmake --build . --target install


3、fast-cdr

获取fast-cdr:

cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-CDR.git
mkdir Fast-CDR/build
cd Fast-CDR/build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
cmake --build . --target install


4、fast-dds

获取fast-dds:

cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-DDS.git
mkdir Fast-DDS/build
cd Fast-DDS/build
cmake ..  -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
cmake --build . --target install

在编译过程中cmake的版本会过低,18.04更新的cmake为3.10左右,fast-dds需要3.16以上

可以进入cmake官网下载相应版本,我采用的是 cmake-3.16.6.tar.gz

解压后

cd cmake-3.16.6
./bootstrap
make
make install

如果本身的cmake版本很高,可以忽略这步。

如上,完成编译安装后需要添加环境:

gedit ~/.bashrc 
export LD_LIBRARY_PATH=/home/mkt/Fast-DDS/install/lib

注意改成自己的路径



5、编译HelloWorldExample

编译成功后开始测试fast-dds的helloworld

定位地址~/Fast-DDS/Fast-DDS-master/examples/cpp/dds/HelloWorldExample

cd ~/Fast-DDS/Fast-DDS/examples/cpp/dds/HelloWorldExample
mkdir build
cd build
cmake -S .. -B . -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
make

获得如下内容:

运行两终端,分别执行发布和订阅

./DDSHelloWorldExample publisher
./DDSHelloWorldExample subscriber




6、安装fast-dds-gen,使用IDL文件构建代码

先安装依赖环境:

sudo apt install openjdk-8-jdk
参考官网执行如下操作:

cd ~~/Fast-DDS/
git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git
cd Fast-DDS-Gen
gradle assemble #这一步会提示找不到gradle,所以执行这一步之前要先安装gradle

#输出下面的信息,说明fast-dds-gen编译成功了。
BUILD SUCCESSFUL in 13s
6 actionable tasks: 4 executed, 2 up-to-date

gedit ~/.bashrc
export PATH=/home/mkt/Fast-DDS/Fast-DDS-Gen/scripts:$PATH
source /etc/profile

完成这些就可以使用fastddsgen来通过idl文件生成代码。

fastddsgen Helloworld.idl

在新路径下拷贝helloworld.idl,执行上述命令,得到如下文件:

至此,fast-dds的基本编译及使用就完成。但是对fastdds的学习来说,这是万里长征的第一步,后续还需要做非常多的工作才能了解fastdds。



参考资料
1、https://blog.csdn.net/mkt123338702/article/details/125880446,这篇文章中有很多细节需要调整,但是文章没有说明,需要自己摸索



标签:cmake,18.04,dds,Fast,cd,DDS,fast
From: https://www.cnblogs.com/zhangzl419/p/16951742.html

相关文章

  • ubuntu18.04安装jdk和gradle
    提纲1、安装jdk2、安装gradle1、安装jdk安装jdk很简单,只要一条命令就可以了,命令如下:sudoaptinstallopenjdk-8-jdkjava-version2、安装gradle#下载gradle......
  • springmvc注册fastJson报错
    原因:依赖版本问题这是我原本引入的依赖,版本是1.2.24<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId......
  • win10安装wsl1的ubuntu18.04
    1.需求主系统:win10子系统:ubuntu18.04,要求wsl1,并且系统默认登录账户为没有密码的root根账户2.步骤(1)启用“适用于Linux的Windows子系统”可选功能在Windows中修改......
  • Ubuntu18.04安装docker
    一、安装1.更新源sudoapt-getupdate2.安装依赖:sudoapt-getinstallapt-transport-httpsca-certificatescurlgnupg2software-properties-common3.信任Do......
  • 【NeurIPS2022】Fast Vision Transformers with HiLo Attention
    这个论文的核心贡献是提出了一种新的注意力机制HiLo(High/Lowfrequency)。如下图所示,在上面部分,分配了\(1-\alpha\)比例的head用于提取高频注意力,下面分配了\(\alp......
  • Fastjson漏洞+复现
    1.漏洞介绍​​FastJson在解析json的过程中,支持使用autoType来实例化某一个具体的类,并调用该类的set/get方法来访问属性。通过查找代码中相关的方法,即可构造出一些恶意利......
  • 修正fastreport for lazarus(linux)的Bug
    1、打开frxDsgnIntf.pas,第1243行:withGetTypeData(GetTypeData(PropertyList[i].PropType^).CompType^)^do改为:{$ifdefnotlinux}withGetTypeData(GetTypeData(Prop......
  • 【FastDfs】Docker自定义构建ARM架构的FastDfs镜像
    由于服务器环境为ARM架构,在部署fastdfs时,发现网上的镜像几乎都是X86_64的,不同架构的镜像还不能通用,这个就有点烦了。。。。。由于之前没有从头编译制作过镜像,步步都是坑,在......
  • ubuntu18.04下cmake的安装
    一.使用安装命令sudoaptinstallcmake这种方式安装最为简单,但是,这种方式安装的不是最新版本的Cmake。我此次安装cmake是因为要编译fastdds,其实之前系统中有cmake,但......
  • linux中awk命令从fasta中提取指定的scaffold
     001、[root@pc1test4]#lstest.fa[root@pc1test4]#cattest.fa##测试fasta文件>mmm11111>bbb8888887777>kkk666666699999>qqq000033333[root@p......