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

what the scale of time stamp in LaserScan topic??

asked 2019-08-29 21:12:26 -0600

kane_choigo gravatar image

hi, i'm making some codes wrt human leg tracker with python and turtlebot2 using kinect2_sensor. (using ROS kinetic in Ububtu 16.04)

To predict human's state correctly, I have to know a time interval between previous and next position.

And I'm going to use [time stamp] variables of LaserScan topic.

But I don't know how big the scale of it is. I mean, I tried to get LaserScan topic and save it as csv file, but the values of [time stamp] was too high to accept. (ex. 1.56704904268227E+018 )

I also calculated time intervals between each other, and still unacceptable was the values of them.

Meanwhile, I have read at ROS wiki that the scale of time stamps would be [seconds] or [nano_seconds]. Could it's scale be nano seconds? If so, the time intervals would be acceptable.

[smple]

field.header.stamp              (time interval) [ns] --->[s]   (maybe???)

1.56704904268227E+018 -

1.56704904294911E+018 ,0.266849792

1.56704904325004E+018 ,0.300928

have a nice day~ :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-08-30 09:35:33 -0600

How are you accessing these stamps? Internally they are stored using two 32 bit integers, one holding the seconds and the other holding nanoseconds. This is described here.

However you can use the toSec() method to convert the value to a 64 bit float value in seconds which will be easier to work with. You might want to use durations from the start of your experiment instead of absolute time stamps, because the time stamps are relative to new years 1980. If that's measured in nanoseconds then you'll get the huge numbers your seeing.

To summarise. Use a ros::Duration to get the time of each data point from the start of the experiment. Then use .toSec() to convert those durations to seconds for external processing.

Hope this helps.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-08-29 21:08:29 -0600

Seen: 292 times

Last updated: Aug 30 '19