cartographer
transform
timestamped_transform.cc
Go to the documentation of this file.
1
/*
2
* Copyright 2017 The Cartographer Authors
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#include "
cartographer/transform/timestamped_transform.h
"
18
19
namespace
cartographer
{
20
namespace
transform {
21
22
TimestampedTransform
Interpolate
(
const
TimestampedTransform
& start,
23
const
TimestampedTransform
& end,
24
const
common::Time
time
) {
25
CHECK_LE(start.
time
, time);
26
CHECK_GE(end.
time
, time);
27
28
const
double
duration =
common::ToSeconds
(end.
time
- start.
time
);
29
const
double
factor =
common::ToSeconds
(time - start.
time
) / duration;
30
const
Eigen::Vector3d origin =
31
start.
transform
.
translation
() +
32
(end.
transform
.
translation
() - start.
transform
.
translation
()) * factor;
33
const
Eigen::Quaterniond rotation =
34
Eigen::Quaterniond(start.
transform
.
rotation
())
35
.slerp(factor, Eigen::Quaterniond(end.
transform
.
rotation
()));
36
return
TimestampedTransform
{
time
,
transform::Rigid3d
(origin, rotation)};
37
}
38
39
}
// namespace transform
40
}
// namespace cartographer
cartographer::transform::Rigid3d
Rigid3< double > Rigid3d
Definition:
rigid_transform.h:225
cartographer::transform::TimestampedTransform
Definition:
timestamped_transform.h:26
cartographer::common::Time
UniversalTimeScaleClock::time_point Time
Definition:
time.h:44
cartographer::transform::Rigid3::rotation
const Quaternion & rotation() const
Definition:
rigid_transform.h:163
cartographer::transform::TimestampedTransform::transform
transform::Rigid3d transform
Definition:
timestamped_transform.h:28
time
static time_point time
Definition:
rate_timer_test.cc:41
cartographer::transform::Interpolate
TimestampedTransform Interpolate(const TimestampedTransform &start, const TimestampedTransform &end, const common::Time time)
Definition:
timestamped_transform.cc:22
timestamped_transform.h
cartographer
Definition:
map_builder_stub.cc:31
cartographer::transform::Rigid3::translation
const Vector & translation() const
Definition:
rigid_transform.h:162
cartographer::common::ToSeconds
double ToSeconds(const Duration duration)
Definition:
time.cc:29
cartographer::transform::TimestampedTransform::time
common::Time time
Definition:
timestamped_transform.h:27
cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58