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: case proto::LoadMapRequest::kPoseGraph:
reader_.AddProto(request.pose_graph()); reader_.AddProto(request.pose_graph());
break; break;
case proto::LoadMapRequest::kAllTrajectoryBuilderOptions:
reader_.AddProto(request.all_trajectory_builder_options());
break;
case proto::LoadMapRequest::kSerializedData: case proto::LoadMapRequest::kSerializedData:
reader_.AddProto(request.serialized_data()); reader_.AddProto(request.serialized_data());
break; break;

View File

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

View File

@ -97,7 +97,20 @@ void MapBuilderStub::SerializeState(
CHECK(client.Write(request)); CHECK(client.Write(request));
proto::WriteMapResponse response; proto::WriteMapResponse response;
while (client.Read(&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()); CHECK(writer->Close());
} }
@ -109,6 +122,7 @@ void MapBuilderStub::LoadMap(
{ {
proto::LoadMapRequest request; proto::LoadMapRequest request;
CHECK(reader->ReadProto(request.mutable_pose_graph())); CHECK(reader->ReadProto(request.mutable_pose_graph()));
CHECK(reader->ReadProto(request.mutable_all_trajectory_builder_options()));
CHECK(client.Write(request)); CHECK(client.Write(request));
} }
// Multiple requests with SerializedData are sent after. // Multiple requests with SerializedData are sent after.

View File

@ -105,7 +105,9 @@ message GetSubmapRequest {
message LoadMapRequest { message LoadMapRequest {
oneof map_chunk { oneof map_chunk {
cartographer.mapping.proto.PoseGraph pose_graph = 1; 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 { message WriteMapResponse {
oneof map_chunk { oneof map_chunk {
cartographer.mapping.proto.PoseGraph pose_graph = 1; 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;
} }
} }