Cartographer向proto::TrajectoryBuilderOptions里面添加参数

Ros端消息格式

cartographer_ros/cartographer_ros_msgs/msg/TrajectoryOptions.msg

添加 bool is_in_slam_mode

在Ros端的cartographer_ros/cartographer_ros/trajectory_options.h

里面添加

struct TrajectoryOptions

{

//难道这个指向C++

::cartographer::mapping::proto::TrajectoryBuilderOptions trajectory_builder_options;

........................

bool is_in_slam_mode;//

参数传递却没有传递过去,因为在    时候传递的是 trajectory_builder_options  这个成员

int trajectory_id =

    map_builder_->AddTrajectoryBuilder( expected_sensor_ids, trajectory_options.trajectory_builder_options,

::std::bind(&MapB..................................

参数添加是通过C++端添加的

C++端消息格式

在C++的proto里面添加参数

/cartographer/mapping/proto/trajectory_builder_options.proto

添加 bool is_in_slam_mode = 5;

出现编译错误,所以要取一个其他的数字

设定  bool is_in_slam_mode = 6;

编译正确

message TrajectoryBuilderOptions {

  LocalTrajectoryBuilderOptions2D trajectory_builder_2d_options = 1;

  LocalTrajectoryBuilderOptions3D trajectory_builder_3d_options = 2;

  bool pure_localization = 3;

  InitialTrajectoryPose initial_trajectory_pose = 4;

  bool is_in_slam_mode = 6;

  message OverlappingSubmapsTrimmerOptions2D {

    int32 fresh_submaps_count = 1;

    double min_covered_area = 2;

    int32 min_added_submaps_count = 3;

  }

  OverlappingSubmapsTrimmerOptions2D overlapping_submaps_trimmer_2d = 5;

}

在cmake之后,会生成到trajectory_builder.lua 文件

include "trajectory_builder_2d.lua"
include "trajectory_builder_3d.lua"

TRAJECTORY_BUILDER = {
  trajectory_builder_2d = TRAJECTORY_BUILDER_2D,
  trajectory_builder_3d = TRAJECTORY_BUILDER_3D,
  pure_localization = false,
  is_in_slam_mode = true,
}

make之后生成trajectory_builder_options.pb.cc 一些列文件,编译安装到linux系统中

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