0
$\begingroup$

Rosanswers logo

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!


Originally posted by BotLover on ROS Answers with karma: 5 on 2018-01-24

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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).


Originally posted by Thomas D with karma: 4347 on 2018-01-24

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.