0
$\begingroup$

Rosanswers logo

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.


Originally posted by nanaky on ROS Answers with karma: 23 on 2014-02-26

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

That looks reasonable.


Originally posted by ahendrix with karma: 47576 on 2014-02-26

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by nanaky on 2014-02-26:
Hi, thanks again for answering. Let's see if someone else knows for sure.

$\endgroup$

Your Answer

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