Move pose_graph_stub/trajectory_builder_stub to internal. (#950)

[Internal hdrs RFC](https://github.com/googlecartographer/rfcs/blob/master/text/0003-internal-headers.md)

Also moved /mapping to /client. Namespace changes will follow.
master
Alexander Belyaev 2018-03-01 18:30:30 +01:00 committed by GitHub
parent 0156e6b8ce
commit 97c039bab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 21 deletions

View File

@ -14,23 +14,31 @@
* limitations under the License.
*/
#include "cartographer_grpc/mapping/map_builder_stub.h"
#include "cartographer_grpc/client/map_builder_stub.h"
#include "cartographer_grpc/handlers/add_trajectory_handler.h"
#include "cartographer_grpc/handlers/finish_trajectory_handler.h"
#include "cartographer_grpc/handlers/get_submap_handler.h"
#include "cartographer_grpc/handlers/load_state_handler.h"
#include "cartographer_grpc/handlers/write_state_handler.h"
#include "cartographer_grpc/internal/client/pose_graph_stub.h"
#include "cartographer_grpc/internal/client/trajectory_builder_stub.h"
#include "cartographer_grpc/proto/map_builder_service.pb.h"
#include "cartographer_grpc/sensor/serialization.h"
#include "glog/logging.h"
namespace cartographer_grpc {
namespace mapping {
namespace {
using ::cartographer::common::make_unique;
} // namespace
MapBuilderStub::MapBuilderStub(const std::string& server_address)
: client_channel_(grpc::CreateChannel(server_address,
grpc::InsecureChannelCredentials())),
pose_graph_stub_(client_channel_) {}
pose_graph_stub_(make_unique<PoseGraphStub>(client_channel_)) {}
int MapBuilderStub::AddTrajectoryBuilder(
const std::set<SensorId>& expected_sensor_ids,
@ -52,8 +60,7 @@ int MapBuilderStub::AddTrajectoryBuilder(
trajectory_builder_stubs_.emplace(
std::piecewise_construct,
std::forward_as_tuple(client.response().trajectory_id()),
std::forward_as_tuple(cartographer::common::make_unique<
cartographer_grpc::mapping::TrajectoryBuilderStub>(
std::forward_as_tuple(make_unique<TrajectoryBuilderStub>(
client_channel_, client.response().trajectory_id(),
local_slam_result_callback)));
return client.response().trajectory_id();
@ -150,7 +157,7 @@ int MapBuilderStub::num_trajectory_builders() const {
}
cartographer::mapping::PoseGraphInterface* MapBuilderStub::pose_graph() {
return &pose_graph_stub_;
return pose_graph_stub_.get();
}
const std::vector<

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
#ifndef CARTOGRAPHER_GRPC_MAPPING_MAP_BUILDER_STUB_H_
#define CARTOGRAPHER_GRPC_MAPPING_MAP_BUILDER_STUB_H_
#ifndef CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_
#define CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_
#include <memory>
#include "cartographer/mapping/map_builder_interface.h"
#include "cartographer_grpc/mapping/pose_graph_stub.h"
#include "cartographer_grpc/mapping/trajectory_builder_stub.h"
#include "cartographer/mapping/pose_graph_interface.h"
#include "cartographer/mapping/trajectory_builder_interface.h"
#include "grpc++/grpc++.h"
namespace cartographer_grpc {
@ -60,12 +60,13 @@ class MapBuilderStub : public cartographer::mapping::MapBuilderInterface {
private:
std::shared_ptr<grpc::Channel> client_channel_;
PoseGraphStub pose_graph_stub_;
std::map<int, std::unique_ptr<TrajectoryBuilderStub>>
std::unique_ptr<cartographer::mapping::PoseGraphInterface> pose_graph_stub_;
std::map<int,
std::unique_ptr<cartographer::mapping::TrajectoryBuilderInterface>>
trajectory_builder_stubs_;
};
} // namespace mapping
} // namespace cartographer_grpc
#endif // CARTOGRAPHER_GRPC_MAPPING_MAP_BUILDER_STUB_H_
#endif // CARTOGRAPHER_GRPC_CLIENT_MAP_BUILDER_STUB_H_

View File

@ -19,9 +19,9 @@
#include "cartographer/mapping/internal/test_helpers.h"
#include "cartographer/mapping/local_slam_result_data.h"
#include "cartographer_grpc/client/map_builder_stub.h"
#include "cartographer_grpc/map_builder_server.h"
#include "cartographer_grpc/map_builder_server_options.h"
#include "cartographer_grpc/mapping/map_builder_stub.h"
#include "cartographer_grpc/testing/mock_map_builder.h"
#include "cartographer_grpc/testing/mock_trajectory_builder.h"
#include "glog/logging.h"

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "cartographer_grpc/mapping/pose_graph_stub.h"
#include "cartographer_grpc/internal/client/pose_graph_stub.h"
#include "cartographer/mapping/pose_graph.h"
#include "cartographer_grpc/framework/client.h"
#include "cartographer_grpc/handlers/get_all_submap_poses.h"

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
#ifndef CARTOGRAPHER_GRPC_MAPPING_POSE_GRAPH_STUB_H_
#define CARTOGRAPHER_GRPC_MAPPING_POSE_GRAPH_STUB_H_
#ifndef CARTOGRAPHER_GRPC_INTERNAL_CLIENT_POSE_GRAPH_STUB_H_
#define CARTOGRAPHER_GRPC_INTERNAL_CLIENT_POSE_GRAPH_STUB_H_
#include "cartographer/mapping/pose_graph_interface.h"
#include "grpc++/grpc++.h"
@ -58,4 +58,4 @@ class PoseGraphStub : public cartographer::mapping::PoseGraphInterface {
} // namespace mapping
} // namespace cartographer_grpc
#endif // CARTOGRAPHER_GRPC_MAPPING_POSE_GRAPH_STUB_H_
#endif // CARTOGRAPHER_GRPC_INTERNAL_CLIENT_POSE_GRAPH_STUB_H_

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "cartographer_grpc/mapping/trajectory_builder_stub.h"
#include "cartographer_grpc/internal/client/trajectory_builder_stub.h"
#include "cartographer/mapping/local_slam_result_data.h"
#include "cartographer_grpc/proto/map_builder_service.pb.h"

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
#ifndef CARTOGRAPHER_GRPC_MAPPING_TRAJECTORY_BUILDER_STUB_H_
#define CARTOGRAPHER_GRPC_MAPPING_TRAJECTORY_BUILDER_STUB_H_
#ifndef CARTOGRAPHER_GRPC_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_
#define CARTOGRAPHER_GRPC_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_
#include <thread>
@ -30,6 +30,8 @@
#include "cartographer_grpc/handlers/add_rangefinder_data_handler.h"
#include "cartographer_grpc/handlers/receive_local_slam_results_handler.h"
#include "grpc++/grpc++.h"
#include "pose_graph_stub.h"
#include "trajectory_builder_stub.h"
namespace cartographer_grpc {
namespace mapping {
@ -88,4 +90,4 @@ class TrajectoryBuilderStub
} // namespace mapping
} // namespace cartographer_grpc
#endif // CARTOGRAPHER_GRPC_MAPPING_TRAJECTORY_BUILDER_STUB_H_
#endif // CARTOGRAPHER_GRPC_INTERNAL_CLIENT_TRAJECTORY_BUILDER_STUB_H_