rclcpp
master
C++ ROS Client Library API
include
rclcpp
clock.hpp
Go to the documentation of this file.
1
// Copyright 2017 Open Source Robotics Foundation, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef RCLCPP__CLOCK_HPP_
16
#define RCLCPP__CLOCK_HPP_
17
18
#include <functional>
19
#include <memory>
20
#include <mutex>
21
22
#include "
rclcpp/macros.hpp
"
23
#include "
rclcpp/time.hpp
"
24
#include "
rclcpp/visibility_control.hpp
"
25
26
#include "
rcl/time.h
"
27
#include "
rcutils/time.h
"
28
#include "
rcutils/types/rcutils_ret.h
"
29
30
namespace
rclcpp
31
{
32
33
class
TimeSource;
34
35
class
JumpHandler
36
{
37
public
:
38
RCLCPP_SMART_PTR_DEFINITIONS
(
JumpHandler
)
39
40
using
pre_callback_t
=
std
::function<
void
()>;
41
using
post_callback_t
=
std
::function<
void
(const
rcl_time_jump_t
&)>;
42
43
JumpHandler
(
44
pre_callback_t
pre_callback
,
45
post_callback_t
post_callback
,
46
const
rcl_jump_threshold_t
& threshold);
47
48
pre_callback_t
pre_callback
;
49
post_callback_t
post_callback
;
50
rcl_jump_threshold_t
notice_threshold
;
51
};
52
53
class
Clock
54
{
55
public
:
56
RCLCPP_SMART_PTR_DEFINITIONS
(
Clock
)
57
58
59
65
RCLCPP_PUBLIC
66
explicit
Clock
(
rcl_clock_type_t
clock_type =
RCL_SYSTEM_TIME
);
67
68
RCLCPP_PUBLIC
69
~
Clock
();
70
77
RCLCPP_PUBLIC
78
Time
79
now();
80
88
RCLCPP_PUBLIC
89
bool
90
ros_time_is_active();
91
93
RCLCPP_PUBLIC
94
rcl_clock_t
*
95
get_clock_handle() noexcept;
96
97
RCLCPP_PUBLIC
98
rcl_clock_type_t
99
get_clock_type()
const
noexcept;
100
102
RCLCPP_PUBLIC
103
std::mutex
&
104
get_clock_mutex() noexcept;
105
106
// Add a callback to invoke if the jump threshold is exceeded.
127
RCLCPP_PUBLIC
128
JumpHandler::SharedPtr
129
create_jump_callback(
130
JumpHandler::pre_callback_t
pre_callback
,
131
JumpHandler::post_callback_t
post_callback
,
132
const
rcl_jump_threshold_t
& threshold);
133
134
private
:
135
// Invoke time jump callback
136
RCLCPP_PUBLIC
137
static
void
138
on_time_jump(
139
const
rcl_time_jump_t
* time_jump,
140
bool
before_jump,
141
void
* user_data);
142
144
class
Impl;
145
146
std::shared_ptr<Impl>
impl_;
147
};
148
149
}
// namespace rclcpp
150
151
#endif // RCLCPP__CLOCK_HPP_
rcl_clock_type_t
rcl_clock_type_t
std::shared_ptr< Impl >
time.h
rclcpp::Time
Definition:
time.hpp:31
std::function< void()>
rclcpp::JumpHandler::post_callback
post_callback_t post_callback
Definition:
clock.hpp:49
rcutils_ret.h
rclcpp
This header provides the get_node_base_interface() template function.
Definition:
allocator_common.hpp:24
RCLCPP_PUBLIC
#define RCLCPP_PUBLIC
Definition:
visibility_control.hpp:50
rclcpp::JumpHandler
Definition:
clock.hpp:35
RCLCPP_SMART_PTR_DEFINITIONS
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition:
macros.hpp:36
rcl_time_jump_t
macros.hpp
rclcpp::JumpHandler::pre_callback
pre_callback_t pre_callback
Definition:
clock.hpp:48
rcl_jump_threshold_t
RCL_SYSTEM_TIME
RCL_SYSTEM_TIME
rcl_clock_t
rclcpp::Clock
Definition:
clock.hpp:53
visibility_control.hpp
std
rclcpp::JumpHandler::notice_threshold
rcl_jump_threshold_t notice_threshold
Definition:
clock.hpp:50
std::mutex
time.hpp
Generated by
1.8.17