ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

LaserScan::scan_time doubt

asked 2014-02-26 00:31:37 -0500

nanaky gravatar image

updated 2014-02-26 04:08:03 -0500

Would it be correct if we used in the field scan_time of the LaserScan message a time difference like this?

sensor_msgs::LaserScan scan;

scan.scan_time= (current_time-last_time).toSec();

Being current_time and last_time two ros::Time objects, so the function toSec() returns the number of seconds between two callbacks (since I have this scan_time in a callback).

Thanks in advance

EDIT: If anyone is wondering why would I do this, it is because I'm defining IR sensors as a LaserScan for using them in the navigation stack. In the robot, the measures update every 33 ms, but the messages to ROS with this measures can come more or less randomly. I take this messages and shape them into a LaserScan.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-26 05:05:25 -0500

ahendrix gravatar image

That looks reasonable.

edit flag offensive delete link more


Hi, thanks again for answering. Let's see if someone else knows for sure.

nanaky gravatar image nanaky  ( 2014-02-26 06:52:35 -0500 )edit

Question Tools

1 follower


Asked: 2014-02-26 00:31:37 -0500

Seen: 615 times

Last updated: Feb 26 '14