源码可在https://github.com/learnmoreonce/SLAM 下载
文件:common/fixed_ratio_sampler.h
#ifndef CARTOGRAPHER_COMMON_FIXED_RATIO_SAMPLER_H_
#define CARTOGRAPHER_COMMON_FIXED_RATIO_SAMPLER_H_
#include <string>
#include "cartographer/common/port.h"
namespace cartographer {
namespace common {
/*
FixedRatioSampler是频率固定的采样器类,目的是从数据流中均匀的按照固定频率采样数据
FixedRatioSampler不可拷贝,不可赋值.
成员函数提供2种操作:
Pulse()产生一个事件pulses,并且:如果计入采样samples,返回true
DebugString():以string形式输出采样率
*/
// Signals when a sample should be taken from a stream of data to select a
// uniformly distributed fraction of the data.
class FixedRatioSampler {
public:
explicit FixedRatioSampler(double ratio);
~FixedRatioSampler();
FixedRatioSampler(