Apollo:源码分析之cyber/service_discovery/role

目录结构

文件说明
role_test.cc单元测试
role.cc实现

我们从role_test.cc学习role.cc是什么实现的。

概述

在cyber RT中,我们将主要通信角色(Role)分为:

  • Node
  • Reader/Writer
  • Server/Client

每个角色使用RoleAttributes进行标志。

在本目录中,实现了三个类:

  • RoleBase
  • RoleWriter
  • RoleServer

分析

首先我们看下它的第一个测试例子,可以看到它测试的是构造函数以及get和set函数
在这里插入图片描述
从上面我们可以看到,这里调用了三个类RoleWriter,RoleServer,里面都有一个成员叫做timestamp_ns,即使ns级别的时间戳。然后我们来看看role.cc是怎么定义它的
在这里插入图片描述
是一个基类,RoleWriter和RoleServer都继承了它。timestamp_ns_是RoleBase的成员变量。
RoleBase
timestamp_ns_这个成员变量可以用来比较哪个成员更早一些。

在这里插入图片描述
在这里插入图片描述
我们接着往下看:
在这里插入图片描述

可以看到RoleBase还有一个成员叫做attributes_,它表示当前角色的属性。比如进程id等。我们可以通过比较这个属性判断两个角色是否是同一个角色,即之前的Match

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

小结

当前目录实现了服务发现中的角色类RoleWriter,RoleServer。我们可以比较这些角色哪个发现的更早或者是否是同一个角色

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
root@in_dev_docker:/apollo# bash scripts/msf_create_lossless_map.sh /apollo/hdmap/pcd_apollo/ 50 /apollo/hdmap/ /apollo/bazel-bin WARNING: Logging before InitGoogleLogging() is written to STDERR E0715 22:08:35.399576 6436 lossless_map_creator.cc:162] num_trials = 1 Pcd folders are as follows: /apollo/hdmap/pcd_apollo/ Resolution: 0.125 Dataset: /apollo/hdmap/pcd_apollo Dataset: /apollo/hdmap/pcd_apollo/ Loaded the map configuration from: /apollo/hdmap//lossless_map/config.xml. Saved the map configuration to: /apollo/hdmap//lossless_map/config.xml. Saved the map configuration to: /apollo/hdmap//lossless_map/config.xml. E0715 22:08:35.767315 6436 lossless_map_creator.cc:264] ieout_poses = 1706 Failed to find match for field 'intensity'. Failed to find match for field 'timestamp'. E0715 22:08:35.769896 6436 velodyne_utility.cc:46] Un-organized-point-cloud E0715 22:08:35.781770 6436 lossless_map_creator.cc:275] Loaded 245443D Points at Trial: 0 Frame: 0. F0715 22:08:35.781791 6436 base_map_node_index.cc:101] Check failed: false *** Check failure stack trace: *** scripts/msf_create_lossless_map.sh: line 11: 6436 Aborted (core dumped) $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/map_creation/lossless_map_creator --use_plane_inliers_only true --pcd_folders $1 --pose_files $2 --map_folder $IN_FOLDER --zone_id $ZONE_ID --coordinate_type UTM --map_resolution_type single root@in_dev_docker:/apollo# bash scripts/msf_create_lossless_map.sh /apollo/hdmap/pcd_apollo/ 50 /apollo/hdmap/
07-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值