ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

time interval between messages published on a topic

asked 2018-01-24 00:41:48 -0500

BotLover gravatar image

Hi everyone, I want to calculate time interval between messages that are published on a topic. The topic is /aruco_poses and of type aruco_mapping/ArucoMarker. It has std_msgs/Header field with stamp containing sec and nsec. But I don't know how to access nsec field from the topic. Any idea? Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-01-24 00:57:40 -0500

Thomas D gravatar image

You can do this with ROS times and durations: roscpp, rospy. You will have to save the previous message, then when you get a new one you can do double elapsed_time = (msg.header.stamp - prev_msg.header.stamp).toSec() (rospy has similar logic).

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

2 followers

Stats

Asked: 2018-01-24 00:41:48 -0500

Seen: 639 times

Last updated: Jan 24 '18