map_builder_server.cc
中注册了一大堆回调函数,例如:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15server_builder.RegisterHandler<handlers::GetLocalToGlobalTransformHandler>();
// get_local_to_global_transform_handler.cc 文件
void GetLocalToGlobalTransformHandler::OnRequest(
const proto::GetLocalToGlobalTransformRequest& request)
{
auto response = absl::make_unique<proto::GetLocalToGlobalTransformResponse>();
auto local_to_global =
GetContext<MapBuilderContextInterface>()
->map_builder()
.pose_graph()
->GetLocalToGlobalTransform(request.trajectory_id());
*response->mutable_local_to_global() = transform::ToProto(local_to_global);
Send(std::move(response));
}
GetLocalToGlobalTransform
可用于获取local坐标系的原点1
2
3
4
5
6
7transform::Rigid3d PoseGraph2D::GetLocalToGlobalTransform(
const int trajectory_id) const
{
absl::MutexLock locker(&mutex_);
return ComputeLocalToGlobalTransform(data_.global_submap_poses_2d,
trajectory_id);
}
同样的还有 PoseGraph2D::GetAllSubmapPoses
, PoseGraph2D::GetTrajectoryStates
, PoseGraph2D::GetTrajectoryNodePoses
, PoseGraph2D::GetLandmarkPoses()
, PoseGraph2D::constraints()
等等
cartographer\cartographer\cloud\internal\handlers
目录有一堆文件,每个文件只定义了一个对应的回调函数,这个回调函数只在map_builder_server.cc
中调用,最终是运行cartographer_grpc_server