-
Notifications
You must be signed in to change notification settings - Fork 479
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
As of yet, rclcpp::Time::max() calls the Time() constructor without specified value for rcl_clock_type_t:
rclcpp/rclcpp/src/rclcpp/time.cpp
Lines 278 to 282 in fff009a
| Time | |
| Time::max() | |
| { | |
| return Time(std::numeric_limits<int32_t>::max(), 999999999); | |
| } |
Hence, rclcpp::Time::max() returns a Time value with clock type RCL_SYSTEM_TIME:
rclcpp/rclcpp/include/rclcpp/time.hpp
Line 46 in fff009a
| Time(int32_t seconds, uint32_t nanoseconds, rcl_clock_type_t clock_type = RCL_SYSTEM_TIME); |
This means that you can't compare time values of type RCL_ROS_TIME to rclcpp::Time::max().
I propose to change the max() implementation as follows:
Time
Time::max(rcl_clock_type_t clock_type = RCL_SYSTEM_TIME)
{
return Time(std::numeric_limits<int32_t>::max(), 999999999, clock_type);
}This is backwards-compatible with the current implementation, yet allows to specify RCL_ROS_TIME if needed, e.g.:
if( reported_time_ < rclcpp::Time::max(RCL_ROS_TIME) {
[...]
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request