Add error messages for gRPC connection failures (#1072)
Fixes https://github.com/googlecartographer/cartographer_ros/issues/825.master
parent
7b68844937
commit
ce71273737
|
@ -32,13 +32,22 @@ namespace cloud {
|
|||
namespace {
|
||||
|
||||
using common::make_unique;
|
||||
constexpr int kConnectionTimeoutInSecond = 10;
|
||||
|
||||
} // namespace
|
||||
|
||||
MapBuilderStub::MapBuilderStub(const std::string& server_address)
|
||||
: client_channel_(::grpc::CreateChannel(
|
||||
server_address, ::grpc::InsecureChannelCredentials())),
|
||||
pose_graph_stub_(make_unique<PoseGraphStub>(client_channel_)) {}
|
||||
pose_graph_stub_(make_unique<PoseGraphStub>(client_channel_)) {
|
||||
LOG(INFO) << "Connecting to SLAM process at " << server_address;
|
||||
std::chrono::system_clock::time_point deadline(
|
||||
std::chrono::system_clock::now() +
|
||||
std::chrono::seconds(kConnectionTimeoutInSecond));
|
||||
if (!client_channel_->WaitForConnected(deadline)) {
|
||||
LOG(FATAL) << "Failed to connect to " << server_address;
|
||||
}
|
||||
}
|
||||
|
||||
int MapBuilderStub::AddTrajectoryBuilder(
|
||||
const std::set<SensorId>& expected_sensor_ids,
|
||||
|
|
|
@ -40,13 +40,12 @@ namespace {
|
|||
|
||||
using common::make_unique;
|
||||
|
||||
constexpr int kConnectionTimeoutInSecond = 10;
|
||||
const common::Duration kPopTimeout = common::FromMilliseconds(100);
|
||||
|
||||
class LocalTrajectoryUploader : public LocalTrajectoryUploaderInterface {
|
||||
public:
|
||||
LocalTrajectoryUploader(const std::string &uplink_server_address)
|
||||
: client_channel_(::grpc::CreateChannel(
|
||||
uplink_server_address, ::grpc::InsecureChannelCredentials())) {}
|
||||
LocalTrajectoryUploader(const std::string &uplink_server_address);
|
||||
~LocalTrajectoryUploader();
|
||||
|
||||
// Starts the upload thread.
|
||||
|
@ -96,6 +95,19 @@ class LocalTrajectoryUploader : public LocalTrajectoryUploaderInterface {
|
|||
add_landmark_client_;
|
||||
};
|
||||
|
||||
LocalTrajectoryUploader::LocalTrajectoryUploader(
|
||||
const std::string &uplink_server_address)
|
||||
: client_channel_(::grpc::CreateChannel(
|
||||
uplink_server_address, ::grpc::InsecureChannelCredentials())) {
|
||||
std::chrono::system_clock::time_point deadline(
|
||||
std::chrono::system_clock::now() +
|
||||
std::chrono::seconds(kConnectionTimeoutInSecond));
|
||||
LOG(INFO) << "Connecting to uplink " << uplink_server_address;
|
||||
if (!client_channel_->WaitForConnected(deadline)) {
|
||||
LOG(FATAL) << "Failed to connect to " << uplink_server_address;
|
||||
}
|
||||
}
|
||||
|
||||
LocalTrajectoryUploader::~LocalTrajectoryUploader() {
|
||||
if (add_imu_client_) {
|
||||
CHECK(add_imu_client_->StreamWritesDone());
|
||||
|
|
Loading…
Reference in New Issue