Skip to content

Commit

Permalink
Moves SensorData struct into Cartographer. (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
damonkohler committed Oct 13, 2016
1 parent edff6a1 commit 5188509
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cartographer/sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ google_library(sensor_configuration
transform_transform
)

google_library(sensor_data
HDRS
data.h
DEPENDS
kalman_filter_pose_tracker
sensor_laser
transform_rigid_transform
)

google_library(sensor_laser
SRCS
laser.cc
Expand Down
67 changes: 67 additions & 0 deletions cartographer/sensor/data.h
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit 5188509

Please sign in to comment.