tf2 rolling
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
Loading...
Searching...
No Matches
time.hpp
Go to the documentation of this file.
1// Copyright 2015-2016, Open Source Robotics Foundation, Inc. All rights reserved.
2//
3// Redistribution and use in source and binary forms, with or without
4// modification, are permitted provided that the following conditions are met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8//
9// * Redistributions in binary form must reproduce the above copyright
10// notice, this list of conditions and the following disclaimer in the
11// documentation and/or other materials provided with the distribution.
12//
13// * Neither the name of the Open Source Robotics Foundation nor the names of its
14// contributors may be used to endorse or promote products derived from
15// this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27// POSSIBILITY OF SUCH DAMAGE.
28
29#ifndef TF2__TIME_HPP_
30#define TF2__TIME_HPP_
31
32#include <chrono>
33#include <cmath>
34#include <string>
35
37
38namespace tf2
39{
40using Duration = std::chrono::nanoseconds;
41using TimePoint = std::chrono::time_point<std::chrono::system_clock, Duration>;
42
43using IDuration = std::chrono::duration<int, std::nano>;
44// This is the zero time in ROS
45static const TimePoint TimePointZero = TimePoint(IDuration::zero());
46
49
52
55
58
61
63std::string displayTimePoint(const TimePoint & stamp);
64
65} // namespace tf2
66
67#endif // TF2__TIME_HPP_
Definition buffer_core.hpp:58
B toMsg(const A &a)
Function that converts from one type to a ROS message type. It has to be implemented by each data typ...
std::chrono::duration< int, std::nano > IDuration
Definition time.hpp:43
double durationToSec(const tf2::Duration &input)
double timeToSec(const TimePoint &timepoint)
std::chrono::time_point< std::chrono::system_clock, Duration > TimePoint
Definition time.hpp:41
std::chrono::nanoseconds Duration
Definition time.hpp:40
std::string displayTimePoint(const TimePoint &stamp)
TimePoint get_now()
TimePoint timeFromSec(double t_sec)
Duration durationFromSec(double t_sec)
#define TF2_PUBLIC
Definition visibility_control.h:57