Moves SensorData struct into Cartographer. (#55)

master
Damon Kohler 2016-10-13 14:17:28 +02:00 committed by GitHub
parent edff6a1e24
commit 518850999f
2 changed files with 76 additions and 0 deletions

View File

@ -43,6 +43,15 @@ google_library(sensor_configuration
transform_transform transform_transform
) )
google_library(sensor_data
HDRS
data.h
DEPENDS
kalman_filter_pose_tracker
sensor_laser
transform_rigid_transform
)
google_library(sensor_laser google_library(sensor_laser
SRCS SRCS
laser.cc laser.cc

View File

@ -0,0 +1,67 @@
/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CARTOGRAPHER_MAPPING_DATA_H_
#define CARTOGRAPHER_MAPPING_DATA_H_
#include <string>
#include "cartographer/kalman_filter/pose_tracker.h"
#include "cartographer/sensor/laser.h"
#include "cartographer/transform/rigid_transform.h"
namespace cartographer {
namespace sensor {
// This type is a logical union, i.e. only one type of sensor data is actually
// filled in. It is only used for time ordering sensor data before passing it
// on.
struct Data {
enum class Type { kImu, kLaserFan3D, kOdometry };
struct Odometry {
transform::Rigid3d pose;
kalman_filter::PoseCovariance covariance;
};
struct Imu {
Eigen::Vector3d linear_acceleration;
Eigen::Vector3d angular_velocity;
};
Data(const string& frame_id, const Imu& imu)
: type(Type::kImu), frame_id(frame_id), imu(imu) {}
Data(const string& frame_id,
const ::cartographer::sensor::LaserFan3D& laser_fan_3d)
: type(Type::kLaserFan3D),
frame_id(frame_id),
laser_fan_3d(laser_fan_3d) {}
Data(const string& frame_id, const Odometry& odometry)
: type(Type::kOdometry), frame_id(frame_id), odometry(odometry) {}
Type type;
string frame_id;
Imu imu;
sensor::LaserFan3D laser_fan_3d;
Odometry odometry;
};
} // namespace sensor
} // namespace cartographer
#endif // CARTOGRAPHER_MAPPING_DATA_H_