Ask Your Question
0

ROS2.0 Timing/Duration Help

asked 2020-07-24 11:10:20 -0500

FutureSomething2036 gravatar image

Hi everyone,

I am very new to using ROS2.0 (Foxy). Im working on a project that uses a publisher/subscriber to send messages. I need to know the time in between when messages are received (i.e. message 1 comes in at time 0, message 2 comes in at time 10, therefore the amount of time between the messages equals 10).

I have scoured the ROS documentation and found out about the "rclcpp::Time" and "rclcpp::Duration" client libraries, but i am having a very hard time understanding how to use them.

Any help/links to guided use of these libraries/written guide would be very helpful!

Much thanks, - New ROS User

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-19 13:58:35 -0500

Debanik Roy gravatar image

updated 2022-01-19 14:01:37 -0500

use that

rclcpp::Time now = this->get_clock()->now();
rclcpp::Time when = this->get_clock()->now() - rclcpp::Duration(5, 0);
rclcpp::Time t_delta = now + rclcpp::Duration(1/10, 0);
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

1 follower

Stats

Asked: 2020-07-24 11:10:20 -0500

Seen: 159 times

Last updated: Jan 19