1.安装

1.安装依赖

sudo apt-get install uuid-dev libboost-all-dev libpoco-dev libgoogle-glog-dev python-dev python-setuptools python-pip 
sudo dpkg -i bros_1.3.0_amd64.deb cmake_3.15.4_amd64.deb cyber-bzl_5.0.0_amd64.deb fastrtps-bzl_1.5.0_amd64.deb protobuf-bzl_3.6.1_amd64.deb
sudo python easy_install protobuf-3.6.1-py2.7.egg

easy_install

复制代码
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==20.7.0','console_scripts','easy_install'
__requires__ = 'setuptools==20.7.0'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('setuptools==20.7.0', 'console_scripts', 'easy_install')()
    )
View Code
复制代码

2.构建

打开终端

测试protobuf安装成功没:

protoc --version

libprotoc 3.6.1

libprotobuf.so->libprotobuf.so.3.6.1

复制代码
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cd examples
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=/opt/bros
make
View Code
复制代码

3.运行

/opt/cyber/setup.bash
./talker # 运行talker
./listener # 运行listener

 4.使用action

复制代码
# 使用Action

复制examples/proto目录下的fibonacci.proto,改为带上你自己的Action名字的protobuf文件,如TestAction.proto

仅仅修改Goal,Result和Feedback部分,其他不要动

```proto
syntax = "proto2";

message Fibonacci // 这里改成你自己的如TestAction
{
    // App definition
    message Goal
    {
        // 这部分改为你自己的Goal定义
        required int32 order = 1;
    }
    message Result
    {
        // 这部分改为你自己的Result定义
       repeated int32 sequence = 1;
    }
    message Feedback
    {
        // 这部分改为你自己的Feedback定义
        repeated int32 sequence = 1;
    }

    // Impl definition
    message Impl
    {
        // Common
        message Time
        {
            required int32 sec = 1;
            required uint32 nanosec = 2;
        }
        message GoalInfo
        {
            required bytes goal_id = 1;
            required Time stamp = 2;
        }
        message GoalStatus
        {
            required GoalInfo goal_info = 1;
            required int32 status = 2;
        }
        // Goal Service
        message SendGoalService
        {
            message Request
            {
                required bytes goal_id = 1;
                required Goal goal = 2;
            }
            message Response
            {
                required Time stamp = 1;
                required bool accepted = 2;
            }
        }
        // CancelGaol service
        message CancelGoalService
        {
            message Request
            {
                required GoalInfo goal_info = 1;
            }
            message Response
            {
     required int32 return_code = 1;
            }
        }
        // Result Service
        message GetResultService
        {
            message Request
            {
                required bytes goal_id = 1;
            }
            message Response
            {
                required bytes goal_id = 1;
                required int32 status = 2;
                required Result result = 3;
            }
        }
        // Feedback publisher
        message FeedbackMessage
        {
            required bytes goal_id = 1;
            required Feedback feedback = 2;
        }
        // GoalStatus publisher
        message GoalStatusMessage
        {
            repeated GoalStatus status_list = 1;
        }
    }
}
```
复制代码

 

posted on   gary_123  阅读(319)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示