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