ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
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

Question Tools

2 followers

Stats

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

Seen: 710 times

Last updated: Jan 24 '18