Cartographer添加新轨迹接口AddTrajectoryBuilderPure(

在接口头文件cartographer/mapping/map_builder_interface.h里面添加
  //wishchin 添加新的重载!//这个虚函数竟然不能添加
  //virtual int AddTrajectoryBuilderPure(
  virtual int AddTrajectoryBuilderConfine(
      const std::set& expected_sensor_ids,
      const proto::TrajectoryBuilderOptions& trajectory_options,
      bool submap_pure_wish,
      LocalSlamResultCallback local_slam_result_callback) = 0;

这个是纯虚函数,必须在子类里面全部实现

定义函数格式

cartographer/mapping/internal/testing/mock_map_builder.h

 MOCK_METHOD4(
      AddTrajectoryBuilderConfine,
      int(const std::set &expected_sensor_ids,
          const mapping::proto::TrajectoryBuilderOptions &trajectory_options,
          bool submap_pure_wish,
          mapping::MapBuilderInterface::LocalSlamResultCallback
              local_slam_result_callback) );

在  cartographer/mapping/map_builder.h里面实例化

  int AddTrajectoryBuilderConfine(
      const std::set &expected_sensor_ids,
      const proto::TrajectoryBuilderOptions &trajectory_options,
      bool submap_pure_wish,
      LocalSlamResultCallback local_slam_result_callback) override;

接口实现cartographer/mapping/map_builder.cc

int MapBuilder::AddTrajectoryBuilderConfine(
    const std::set& expected_sensor_ids,
    const proto::TrajectoryBuilderOptions& trajectory_options,
    bool submap_pure_wish,
    LocalSlamResultCallback local_slam_result_callback)
{
# ifdef LOG_FUNC_wish
   { LOG(INFO) << "..func...MapBuilder::AddTrajec................

同样需要在所有的派生类里面实现实例化

CollatedTrajectoryBuilder和GlobalTrajectoryBuilder2D都继承于TrajectoryBuilderInterface

其他工作

需要Dispatchable::Data 和 AddSensorData(  预先完成

过程:

CollatedTrajectoryBuilder需要sensor_collator_, GlobalTrajectoryBuilder2D;

data->AddToTrajectoryBuilder

5GlobalTrajectoryBuilder2D->AddSensorData

你可能感兴趣的:(三维重建/SLAM,算法,数据结构)