fixed_frame_pose_data.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "cartographer/sensor/fixed_frame_pose_data.h"
00018 
00019 #include "absl/types/optional.h"
00020 #include "cartographer/transform/transform.h"
00021 
00022 namespace cartographer {
00023 namespace sensor {
00024 
00025 proto::FixedFramePoseData ToProto(const FixedFramePoseData& pose_data) {
00026   proto::FixedFramePoseData proto;
00027   proto.set_timestamp(common::ToUniversal(pose_data.time));
00028   if (pose_data.pose.has_value()) {
00029     *proto.mutable_pose() = transform::ToProto(pose_data.pose.value());
00030   }
00031   return proto;
00032 }
00033 
00034 FixedFramePoseData FromProto(const proto::FixedFramePoseData& proto) {
00035   return FixedFramePoseData{common::FromUniversal(proto.timestamp()),
00036                             proto.has_pose()
00037                                 ? absl::optional<transform::Rigid3d>(
00038                                       transform::ToRigid3(proto.pose()))
00039                                 : absl::optional<transform::Rigid3d>()};
00040 }
00041 
00042 }  // namespace sensor
00043 }  // namespace cartographer


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35