Follow googlecartographer/cartographer#859 (#892)

master
Christoph Schütte 2018-02-07 16:35:44 +01:00 committed by Wally B. Feed
parent 95dbcfdf9e
commit 39f140da66
4 changed files with 27 additions and 3 deletions

View File

@ -31,6 +31,9 @@ void LoadMapHandler::OnRequest(const proto::LoadMapRequest& request) {
case proto::LoadMapRequest::kPoseGraph:
reader_.AddProto(request.pose_graph());
break;
case proto::LoadMapRequest::kAllTrajectoryBuilderOptions:
reader_.AddProto(request.all_trajectory_builder_options());
break;
case proto::LoadMapRequest::kSerializedData:
reader_.AddProto(request.serialized_data());
break;

View File

@ -39,6 +39,9 @@ void WriteMapHandler::OnRequest(const google::protobuf::Empty& request) {
cartographer::common::make_unique<proto::WriteMapResponse>();
if (proto->GetTypeName() == "cartographer.mapping.proto.PoseGraph") {
response->mutable_pose_graph()->CopyFrom(*proto);
} else if (proto->GetTypeName() ==
"cartographer.mapping.proto.AllTrajectoryBuilderOptions") {
response->mutable_all_trajectory_builder_options()->CopyFrom(*proto);
} else if (proto->GetTypeName() ==
"cartographer.mapping.proto.SerializedData") {
response->mutable_serialized_data()->CopyFrom(*proto);

View File

@ -97,7 +97,20 @@ void MapBuilderStub::SerializeState(
CHECK(client.Write(request));
proto::WriteMapResponse response;
while (client.Read(&response)) {
writer->WriteProto(response);
// writer->WriteProto(response);
switch (response.map_chunk_case()) {
case proto::WriteMapResponse::kPoseGraph:
writer->WriteProto(response.pose_graph());
break;
case proto::WriteMapResponse::kAllTrajectoryBuilderOptions:
writer->WriteProto(response.all_trajectory_builder_options());
break;
case proto::WriteMapResponse::kSerializedData:
writer->WriteProto(response.serialized_data());
break;
default:
LOG(FATAL) << "Unhandled message type";
}
}
CHECK(writer->Close());
}
@ -109,6 +122,7 @@ void MapBuilderStub::LoadMap(
{
proto::LoadMapRequest request;
CHECK(reader->ReadProto(request.mutable_pose_graph()));
CHECK(reader->ReadProto(request.mutable_all_trajectory_builder_options()));
CHECK(client.Write(request));
}
// Multiple requests with SerializedData are sent after.

View File

@ -105,7 +105,9 @@ message GetSubmapRequest {
message LoadMapRequest {
oneof map_chunk {
cartographer.mapping.proto.PoseGraph pose_graph = 1;
cartographer.mapping.proto.SerializedData serialized_data = 2;
cartographer.mapping.proto.AllTrajectoryBuilderOptions
all_trajectory_builder_options = 2;
cartographer.mapping.proto.SerializedData serialized_data = 3;
}
}
@ -163,7 +165,9 @@ message AddLocalSlamResultDataRequest {
message WriteMapResponse {
oneof map_chunk {
cartographer.mapping.proto.PoseGraph pose_graph = 1;
cartographer.mapping.proto.SerializedData serialized_data = 2;
cartographer.mapping.proto.AllTrajectoryBuilderOptions
all_trajectory_builder_options = 2;
cartographer.mapping.proto.SerializedData serialized_data = 3;
}
}