cartographer_grpc_server的源码

node_grpc_main.cc中的关键一句:

1
2
auto map_builder = absl::make_unique<::cartographer::cloud::MapBuilderStub>(
FLAGS_server_address, FLAGS_client_id);

接着看map_builder_stub.cc的构造函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
MapBuilderStub::MapBuilderStub(const std::string& server_address,
const std::string& client_id)
: client_channel_(::grpc::CreateChannel(
server_address, ::grpc::InsecureChannelCredentials())),
pose_graph_stub_(make_unique<PoseGraphStub>(client_channel_, client_id)),
client_id_(client_id)
{
LOG(INFO) << "Connecting to SLAM process at " << server_address
<< " with client_id " << client_id;
std::chrono::system_clock::time_point deadline(
std::chrono::system_clock::now() +
std::chrono::seconds(kChannelTimeoutSeconds));
if (!client_channel_->WaitForConnected(deadline)) {
LOG(FATAL) << "Failed to connect to " << server_address;
}
}