ROS 2 rclcpp + rcl - kilted
kilted
ROS 2 C++ Client Library with ROS Client Library
|
Public Member Functions | |
RCLCPP_PUBLIC | Time (int32_t seconds, uint32_t nanoseconds, rcl_clock_type_t clock_type=RCL_SYSTEM_TIME) |
Time constructor. More... | |
RCLCPP_PUBLIC | Time (int64_t nanoseconds=0, rcl_clock_type_t clock_type=RCL_SYSTEM_TIME) |
Time constructor. More... | |
RCLCPP_PUBLIC | Time (const Time &rhs) |
Copy constructor. | |
RCLCPP_PUBLIC | Time (Time &&rhs) noexcept |
Move constructor. | |
RCLCPP_PUBLIC | Time (const builtin_interfaces::msg::Time &time_msg, rcl_clock_type_t clock_type=RCL_ROS_TIME) |
Time constructor. More... | |
RCLCPP_PUBLIC | Time (const rcl_time_point_t &time_point) |
Time constructor. More... | |
virtual RCLCPP_PUBLIC | ~Time () |
Time destructor. | |
RCLCPP_PUBLIC | operator builtin_interfaces::msg::Time () const |
Return a builtin_interfaces::msg::Time object based. | |
RCLCPP_PUBLIC Time & | operator= (const Time &rhs) |
RCLCPP_PUBLIC Time & | operator= (const builtin_interfaces::msg::Time &time_msg) |
RCLCPP_PUBLIC Time & | operator= (Time &&rhs) noexcept |
RCLCPP_PUBLIC bool | operator== (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC bool | operator!= (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC bool | operator< (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC bool | operator<= (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC bool | operator>= (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC bool | operator> (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC Time | operator+ (const rclcpp::Duration &rhs) const |
RCLCPP_PUBLIC Duration | operator- (const rclcpp::Time &rhs) const |
RCLCPP_PUBLIC Time | operator- (const rclcpp::Duration &rhs) const |
RCLCPP_PUBLIC Time & | operator+= (const rclcpp::Duration &rhs) |
RCLCPP_PUBLIC Time & | operator-= (const rclcpp::Duration &rhs) |
RCLCPP_PUBLIC rcl_time_point_value_t | nanoseconds () const |
Get the nanoseconds since epoch. More... | |
RCLCPP_PUBLIC double | seconds () const |
Get the seconds since epoch. More... | |
RCLCPP_PUBLIC rcl_clock_type_t | get_clock_type () const |
Get the clock type. More... | |
Static Public Member Functions | |
static RCLCPP_PUBLIC Time | max (rcl_clock_type_t clock_type=RCL_SYSTEM_TIME) |
Get the maximum representable value. More... | |
rclcpp::Time::Time | ( | int32_t | seconds, |
uint32_t | nanoseconds, | ||
rcl_clock_type_t | clock_type = RCL_SYSTEM_TIME |
||
) |
Time constructor.
Initializes the time values for seconds and nanoseconds individually. Large values for nanoseconds are wrapped automatically with the remainder added to seconds. Both inputs must be integers.
seconds | part of the time in seconds since time epoch |
nanoseconds | part of the time in nanoseconds since time epoch |
clock_type | clock type |
std::runtime_error | if seconds are negative |
Definition at line 49 of file time.cpp.
References rcl_time_point_s::nanoseconds, nanoseconds(), RCL_S_TO_NS, and seconds().
Referenced by max(), operator+(), operator-(), and operator=().
|
explicit |
Time constructor.
nanoseconds | since time epoch |
clock_type | clock type |
std::runtime_error | if nanoseconds are negative |
Definition at line 60 of file time.cpp.
References rcl_time_point_s::nanoseconds, and nanoseconds().
rclcpp::Time::Time | ( | const builtin_interfaces::msg::Time & | time_msg, |
rcl_clock_type_t | clock_type = RCL_ROS_TIME |
||
) |
Time constructor.
time_msg | builtin_interfaces time message to copy |
clock_type | clock type |
std::runtime_error | if seconds are negative |
Definition at line 74 of file time.cpp.
References rcl_time_point_s::nanoseconds, and RCL_S_TO_NS.
|
explicit |
rcl_clock_type_t rclcpp::Time::get_clock_type | ( | ) | const |
Get the clock type.
Definition at line 228 of file time.cpp.
References rcl_time_point_s::clock_type.
Referenced by rclcpp::operator+(), and rclcpp::Clock::sleep_until().
|
static |
int64_t rclcpp::Time::nanoseconds | ( | ) | const |
Get the nanoseconds since epoch.
Definition at line 216 of file time.cpp.
References rcl_time_point_s::nanoseconds.
Referenced by rclcpp::topic_statistics::SubscriptionTopicStatistics::handle_message(), rclcpp::operator+(), operator+(), rclcpp::Clock::sleep_until(), and Time().
Time rclcpp::Time::operator+ | ( | const rclcpp::Duration & | rhs | ) | const |
std::overflow_error | if addition leads to overflow |
Definition at line 170 of file time.cpp.
References rclcpp::add_will_overflow(), rclcpp::add_will_underflow(), rclcpp::Duration::nanoseconds(), nanoseconds(), and Time().
Time & rclcpp::Time::operator+= | ( | const rclcpp::Duration & | rhs | ) |
std::overflow_error | if addition leads to overflow |
Definition at line 246 of file time.cpp.
References rclcpp::add_will_overflow(), rclcpp::add_will_underflow(), rcl_time_point_s::nanoseconds, and rclcpp::Duration::nanoseconds().
Time rclcpp::Time::operator- | ( | const rclcpp::Duration & | rhs | ) | const |
std::overflow_error | if addition leads to overflow |
Definition at line 203 of file time.cpp.
References rcl_time_point_s::clock_type, rcl_time_point_s::nanoseconds, rclcpp::Duration::nanoseconds(), rclcpp::sub_will_overflow(), rclcpp::sub_will_underflow(), and Time().
Duration rclcpp::Time::operator- | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
std::overflow_error | if addition leads to overflow |
Definition at line 182 of file time.cpp.
References rcl_time_point_s::clock_type, rclcpp::Duration::from_nanoseconds(), rcl_time_point_s::nanoseconds, rclcpp::sub_will_overflow(), and rclcpp::sub_will_underflow().
Time & rclcpp::Time::operator-= | ( | const rclcpp::Duration & | rhs | ) |
std::overflow_error | if addition leads to overflow |
Definition at line 264 of file time.cpp.
References rcl_time_point_s::nanoseconds, rclcpp::Duration::nanoseconds(), rclcpp::sub_will_overflow(), and rclcpp::sub_will_underflow().
bool rclcpp::Time::operator< | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
Definition at line 129 of file time.cpp.
References rcl_time_point_s::clock_type, and rcl_time_point_s::nanoseconds.
bool rclcpp::Time::operator<= | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
Definition at line 139 of file time.cpp.
References rcl_time_point_s::clock_type, and rcl_time_point_s::nanoseconds.
Time & rclcpp::Time::operator= | ( | const builtin_interfaces::msg::Time & | time_msg | ) |
Assign Time from a builtin_interfaces::msg::Time instance. The clock_type will be reset to RCL_ROS_TIME. Equivalent to *this = Time(time_msg, RCL_ROS_TIME).
std::runtime_error | if seconds are negative |
Definition at line 104 of file time.cpp.
References Time().
Copy assignment operator
std::runtime_error | if seconds are negative |
bool rclcpp::Time::operator== | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
Definition at line 114 of file time.cpp.
References rcl_time_point_s::clock_type, and rcl_time_point_s::nanoseconds.
bool rclcpp::Time::operator> | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
Definition at line 160 of file time.cpp.
References rcl_time_point_s::clock_type, and rcl_time_point_s::nanoseconds.
bool rclcpp::Time::operator>= | ( | const rclcpp::Time & | rhs | ) | const |
std::runtime_error | if the time sources are different |
Definition at line 150 of file time.cpp.
References rcl_time_point_s::clock_type, and rcl_time_point_s::nanoseconds.
double rclcpp::Time::seconds | ( | ) | const |
Get the seconds since epoch.
Definition at line 222 of file time.cpp.
References rcl_time_point_s::nanoseconds.
Referenced by Time().