cartographer代码里懵比的瞬间

28 篇文章 2 订阅

 ::namespace

void Node::MaybeWarnAboutTopicMismatch(
    const ::ros::WallTimerEvent& unused_timer_event) {
  ::ros::master::V_TopicInfo ros_topics;
  ::ros::master::getTopics(ros_topics);
  std::set<std::string> published_topics;
  std::stringstream published_topics_string;
  for (const auto& it : ros_topics) 

一开始看到命名空间前面加::感觉很神奇,谷歌里的大神写的代码就是吊,再后来感觉这玩意没啥用,谷歌大神就喜欢装比,实在摸不着头脑,查了一下资料,你大爷还是你大爷!原来加上::是把该命名空间或者函数定义成全局的,避免出错。

命名空间和函数前面加上:: - maolike - 博客园经常看到命名空间前就只有:: 比如 ::test;这种代表是全局的test 比如 ::CreateDirectory(..),代表使用系统API也就是全局的 避免使用到局部定义的test命名空间或者函https://www.cnblogs.com/likemao/p/10368614.html

  Node(const Node&) = delete; 

  explicit Node(double resolution, double publish_period_sec);
  ~Node() {}

  Node(const Node&) = delete;
  Node& operator=(const Node&) = delete;

GUARDED_BY(mutex_)

std::map<SubmapId, SubmapSlice> submap_slices_ GUARDED_BY(mutex_);

copy_if

PointCloud CropPointCloud(const PointCloud& point_cloud, const float min_z,
                          const float max_z)
{
  return point_cloud.copy_if([min_z, max_z](const RangefinderPoint& point) {
return min_z <= point.position.z() && point.position.z() <= max_z;
});
}

....

  // Creates a PointCloud consisting of all the points for which `predicate`
  // returns true, together with the corresponding intensities.
  template <class UnaryPredicate>
  PointCloud copy_if(UnaryPredicate predicate) const {
    std::vector<PointType> points;
    std::vector<float> intensities;

    // Note: benchmarks show that it is better to have this conditional outside
    // the loop.
    if (intensities_.empty()) {
      for (size_t index = 0; index < size(); ++index) {
        const PointType& point = points_[index];
        if (predicate(point)) {
          points.push_back(point);
        }
      }
    } else {
      for (size_t index = 0; index < size(); ++index) {
        const PointType& point = points_[index];
        if (predicate(point)) {
          points.push_back(point);
          intensities.push_back(intensities_[index]);
        }
      }
    }

    return PointCloud(points, intensities);
  }

std::floor

四舍五入

C++ floor、ceil、round函数的区别_魔神之云的博客-CSDN博客_c++floor和ceilhttps://blog.csdn.net/hl3129450985/article/details/113703004?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1.pc_relevant_default&utm_relevant_index=1

ceil 

 

 

 Eigen::Map<VType>(f, kDataDimension)

Eigen库中的Map类到底是做什么的? - 知乎https://www.cnblogs.com/houkai/p/6349981.html使用Map变量可以像Eigen的其他类型一样来使用Map类型。ty…https://www.zhihu.com/question/43571898/answer/450764578

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值