// 包含了子图的id, 节点的id, 节点j相对于子图i的坐标变换, 以及节点是在子图内还是子图外的标志 structConstraint { structPose { transform::Rigid3d zbar_ij; double translation_weight; double rotation_weight; }; SubmapId submap_id; // 'i' in the paper. NodeId node_id; // 'j' in the paper.
// Pose of the node 'j' relative to submap 'i'. Pose pose;
// Differentiates between intra-submap (where node 'j' was inserted into // submap 'i') and inter-submap constraints (where node 'j' was not inserted // into submap 'i'). enumTag { INTRA_SUBMAP, INTER_SUBMAP } tag; };
// Global submap poses currently used for displaying data. // submap 在 global 坐标系下的坐标 MapById<SubmapId, optimization::SubmapSpec2D> global_submap_poses_2d; MapById<SubmapId, optimization::SubmapSpec3D> global_submap_poses_3d;
// Data that are currently being shown. // 所有的轨迹节点的id与 节点的在global坐标系下的坐标, 在local map 下的坐标与时间 MapById<NodeId, TrajectoryNode> trajectory_nodes;
// Global landmark poses with all observations. std::map<std::string /* landmark ID */, PoseGraphInterface::LandmarkNode> landmark_nodes;
// How our various trajectories are related. TrajectoryConnectivityState trajectory_connectivity_state; // 节点的个数 int num_trajectory_nodes = 0; // 轨迹与轨迹的状态 std::map<int, InternalTrajectoryState> trajectories_state;
// Set of all initial trajectory poses. std::map<int, PoseGraph::InitialTrajectoryPose> initial_trajectory_poses;
// Transform to approximately gravity align the tracking frame as // determined by local SLAM. Eigen::Quaterniond gravity_alignment;
// Used for loop closure in 2D: voxel filtered returns in the // 'gravity_alignment' frame. sensor::PointCloud filtered_gravity_aligned_point_cloud;
// Used for loop closure in 3D. sensor::PointCloud high_resolution_point_cloud; sensor::PointCloud low_resolution_point_cloud; Eigen::VectorXf rotational_scan_matcher_histogram;
// The node pose in the local SLAM frame. transform::Rigid3d local_pose; }; common::Time time()const{ return constant_data->time; }
// This must be a shared_ptr. If the data is used for visualization while the // node is being trimmed, it must survive until all use finishes. std::shared_ptr<const Data> constant_data; // 不会被后端优化修改的数据, 所以是constant
// The node pose in the global SLAM frame. transform::Rigid3d global_pose; // 后端优化后, global_pose会发生改变
// Test if the 'insertion_submap.back()' is one we never saw before. // 如果是刚开始的轨迹, 或者insertion_submaps.back()是第一次看到, 就添加新的子图 if (data_.submap_data.SizeOfTrajectoryOrZero(trajectory_id) == 0 || std::prev(data_.submap_data.EndOfTrajectory(trajectory_id)) ->data.submap != insertion_submaps.back()) { // We grow 'data_.submap_data' as needed. This code assumes that the first // time we see a new submap is as 'insertion_submaps.back()'.