zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Apollo CyberRT(v8.0.0) Cmake Build

build CMake Apollo
2023-09-14 09:09:26 时间

#1 CyberRT Standalone

CyberRT仓库: https://github.com/minhanghuang/CyberRT

将CyberRT从Apollo拆分,使用Cmake编译, 不依赖Apollo独立运行

在这里插入图片描述

#1.1 环境

Ubuntu 18.04 
Ubuntu 20.04
Apollo 8.0.0
Cmake

  
  
  • 1
  • 2
  • 3
  • 4

#1.2 使用

  1. 安装依赖
sudo apt install libpoco-dev
sudo apt install uuid-dev
pip3 install protobuf

  
  
  • 1
  • 2
  • 3
  1. 克隆代码
git clone git@github.com:minhanghuang/CyberRT.git
cd CyberRT

  
  
  • 1
  • 2
  1. 加载环境

third party(gflag gtest glog fastrtps fastcdr…)

// 拷贝环境到指定路径, 必须是/opt/cyber/env路径
sudo mkdir /opt/cyber
sudo cp -r env/ /opt/cyber/env

  
  
  • 1
  • 2
  • 3

根据自己的终端运行对应的脚本,不知道自己的terminal是bash还是zsh,运行echo $0查看输出结果

// 二选一
// bash
source /opt/cyber/env/setup.bash

// zsh
source /opt/cyber/env/setup.zsh

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 生成protobuf文件
/opt/cyber/env/bin/protoc -I=cyber/proto/ --cpp_out=cyber/proto cyber/proto/*.proto

/opt/cyber/env/bin/protoc -I=cyber/examples/proto/ –cpp_out=cyber/examples/proto cyber/examples/proto/*.proto

  • 1
  • 2
  • 3
  1. 编译
mkdir build && cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
make

 
 
  • 1
  • 2
  • 3
  1. 运行examples
  • pub/sub

pub

source setup.bash
./cyber/examples/cyber_example_talker

 
 
  • 1
  • 2

sub

source setup.bash
./cyber/examples/cyber_example_listener

 
 
  • 1
  • 2
  • server/client

server

source setup.bash
./cyber/examples/cyber_example_server

 
 
  • 1
  • 2

client

source setup.bash
./cyber/examples/cyber_example_cilent

 
 
  • 1
  • 2