amcl中三个类(AMCLLaserData,AMCLSensorData,AMCLOdomData)

在ROS的amcl的节点中,传感器数据有激光传感器数据,里程计传感器数据。传感器的数据结构主要有三个数据内心进行存储。

AMCLSensorData
AMCLLaserData
AMCLOdomData
这三个数据结构分别定义在amcl_sersor.h, amcl_odom.h 和 amcl_laser.h的头文件中。
其中:
AMCLLaserData和AMCLOdomData都共有继承了AMCLSensorData

这三个数数据结构如下

class AMCLSensorData
{
  public: AMCLSensor *sensor;     //实例化的AMCLSensor的指针
          virtual ~AMCLSensorData() {}   //析构函数定义成了一个虚函数
  public: double time;    //包含了一个时间戳
};

其中,AMCLSensor的数据结构声明如下:

class AMCLSensor
{
  public: AMCLSensor();   //构造函数
  public: virtual ~AMCLSensor();  //析构函数同样定义为一个虚函数

  // Update the filter based on the action model.  Returns true if the filter has been updated.
  //基于运动模型更新滤波器,如果滤波器已经更新就返回true
  public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);

  // Initialize the filter based on the sensor model.  Returns true if the
  // filter has been initialized.
  //根据传感器数据模型初始化滤波器,如果滤波器已经被更新就返回true
  public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);

  // Update the filter based on the sensor model.  Returns true if the
  // filter has been updated.
  //根据传感器数据模型更新滤波器,如果滤波器已经被更新就返回true
  public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);

  // Flag is true if this is the action sensor
  public: bool is_action;

  // Action pose (action sensors only)
  public: pf_vector_t pose;

  // AMCL Base
  //protected: AdaptiveMCL & AMCL;
};

AMCLSensor数据结构的定义如下:

AMCLSensor::AMCLSensor()
{
  return;
}
AMCLSensor::~AMCLSensor()
{
}
// Apply the action model
bool AMCLSensor::UpdateAction(pf_t *pf, AMCLSensorData *data)
{
  return false;
}

// Initialize the filter
bool AMCLSensor::InitSensor(pf_t *pf, AMCLSensorData *data)
{
  return false;
}

// Apply the sensor model
bool AMCLSensor::UpdateSensor(pf_t *pf, AMCLSensorData *data)
{
  return false;
}

AMCLOdomData数据结构:

class AMCLOdomData : public AMCLSensorData     //里程计数据结构为共有继承AMCLSensorData
{
  public: pf_vector_t pose;     //pose里程计的位姿
  public: pf_vector_t delta;    //delta为里程计位姿的改变
};

AMCLLaserData的数据结构:

class AMCLLaserData : public AMCLSensorData    //仍然公有继承AMCLSensorData的类
{
  public:
    AMCLLaserData () {ranges=NULL;};
    virtual ~AMCLLaserData() {delete [] ranges;};
  // Laser range data (range, bearing tuples)
  public: int range_count;
  public: double range_max;
  public: double (*ranges)[2];
};

猜你喜欢

转载自blog.csdn.net/yuyushikuan/article/details/80943184