Remove implementation from TrajectoryBuilder. (#728)

To simplify the implementation of a gRPC-based trajectory builder,
this moves the existing implementation to CollatedTrajectoryBuilder
and organizes the interface by sensor type.
master
gaschler 2017-12-05 11:05:05 +01:00 committed by GitHub
parent ee9c61a736
commit b77a1f2178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 29 deletions

View File

@ -49,10 +49,39 @@ class CollatedTrajectoryBuilder : public TrajectoryBuilder {
CollatedTrajectoryBuilder& operator=(const CollatedTrajectoryBuilder&) =
delete;
void AddSensorData(const std::string& sensor_id,
std::unique_ptr<sensor::Data> data) override;
void AddRangefinderData(const std::string& sensor_id, common::Time time,
const Eigen::Vector3f& origin,
const sensor::TimedPointCloud& ranges) override {
AddSensorData(sensor_id,
common::make_unique<sensor::DispatchableRangefinderData>(
time, origin, ranges));
}
void AddImuData(const std::string& sensor_id, common::Time time,
const Eigen::Vector3d& linear_acceleration,
const Eigen::Vector3d& angular_velocity) override {
AddSensorData(sensor_id, sensor::MakeDispatchable(sensor::ImuData{
time, linear_acceleration, angular_velocity}));
}
void AddOdometerData(const std::string& sensor_id, common::Time time,
const transform::Rigid3d& odometer_pose) override {
AddSensorData(sensor_id, sensor::MakeDispatchable(
sensor::OdometryData{time, odometer_pose}));
}
void AddFixedFramePoseData(
const std::string& sensor_id, common::Time time,
const transform::Rigid3d& fixed_frame_pose) override {
AddSensorData(sensor_id,
sensor::MakeDispatchable(
sensor::FixedFramePoseData{time, fixed_frame_pose}));
}
private:
void AddSensorData(const std::string& sensor_id,
std::unique_ptr<sensor::Data> data);
void HandleCollatedSensorData(const std::string& sensor_id,
std::unique_ptr<sensor::Data> data);

View File

@ -46,36 +46,21 @@ class TrajectoryBuilder {
TrajectoryBuilder(const TrajectoryBuilder&) = delete;
TrajectoryBuilder& operator=(const TrajectoryBuilder&) = delete;
virtual void AddSensorData(const std::string& sensor_id,
std::unique_ptr<sensor::Data> data) = 0;
void AddRangefinderData(const std::string& sensor_id, common::Time time,
virtual void AddRangefinderData(const std::string& sensor_id,
common::Time time,
const Eigen::Vector3f& origin,
const sensor::TimedPointCloud& ranges) {
AddSensorData(sensor_id,
common::make_unique<sensor::DispatchableRangefinderData>(
time, origin, ranges));
}
const sensor::TimedPointCloud& ranges) = 0;
void AddImuData(const std::string& sensor_id, common::Time time,
virtual void AddImuData(const std::string& sensor_id, common::Time time,
const Eigen::Vector3d& linear_acceleration,
const Eigen::Vector3d& angular_velocity) {
AddSensorData(sensor_id, sensor::MakeDispatchable(sensor::ImuData{
time, linear_acceleration, angular_velocity}));
}
const Eigen::Vector3d& angular_velocity) = 0;
void AddOdometerData(const std::string& sensor_id, common::Time time,
const transform::Rigid3d& odometer_pose) {
AddSensorData(sensor_id, sensor::MakeDispatchable(
sensor::OdometryData{time, odometer_pose}));
}
virtual void AddOdometerData(const std::string& sensor_id, common::Time time,
const transform::Rigid3d& odometer_pose) = 0;
void AddFixedFramePoseData(const std::string& sensor_id, common::Time time,
const transform::Rigid3d& fixed_frame_pose) {
AddSensorData(sensor_id,
sensor::MakeDispatchable(
sensor::FixedFramePoseData{time, fixed_frame_pose}));
}
virtual void AddFixedFramePoseData(
const std::string& sensor_id, common::Time time,
const transform::Rigid3d& fixed_frame_pose) = 0;
};
} // namespace mapping