Ask Your Question
0

`rclcpp::Clock(RCL_ROS_TIME).now()` vs. `node_->get_clock()->now()`

asked 2021-12-02 04:11:19 -0600

galou gravatar image

Is rclcpp::Clock(RCL_ROS_TIME).now() always the same as node_->get_clock()->now()?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-12-04 15:13:30 -0600

aprotyas gravatar image

Well, if the rclcpp::Clock object on which you'll call now() refers to the clock belonging to the rclcpp::Node object, then yes, they are the same. These can semantically mean different things if you're talking about different clocks.

edit flag offensive delete link more
0

answered 2021-12-02 20:50:55 -0600

Looking at the source code for both, I believe they are the same:

For rcrclcpp::Clock(RCL_ROS_TIME).now()source code: https://docs.ros2.y org/foxy/api/rclcpp/clock_8hpp_source.html

And for node_->get_clock()->now()source code: https://docs.ros2.org/dashing/api/rcl...

Both are declared the same way:

 RCLCPP_PUBLIC
   Time
   now()

The only difference I see is the first one is more direct method .

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2021-12-02 04:11:19 -0600

Seen: 25 times

Last updated: Dec 04 '21