@sloretz: You can wrap the clock provided by the node again in a std::chrono
clock wrapper and you would have simulation time available.:
struct ros2_node_clock
{
ros2_node_clock(std::shared_ptr<Clock> clock) : m_clock(clock) {}
typedef std::chrono::nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef std::chrono::time_point<ros2_clock, duration> time_point;
static constexpr bool is_steady = false;
static time_point
now() noexcept {
return time_point(duration(clock->now().nanoseconds()));
}
std::shared_ptr<Clock> m_clock;
};
ros2_node_clock rclcpp::None::get_std_clock() {
return ros2_node_clock(get_clock());
}
The additional safety of not mixing clocks is lost in this case, but ROS 2 time is also not safe in this regard and not likely solvable.