vrep ros interface timestamp

Typically: "How do I... ", "How can I... " questions
Post Reply
hypnosfeel
Posts: 22
Joined: 03 Mar 2014, 16:05

vrep ros interface timestamp

Post by hypnosfeel »

Hello all,

The ros timestamp published by vrep ros interface doesn't match the ros timestamp published by other ros packages. Do you guys know how to synchronize vrep time to roscore time?

The timestamp of /novatel/gps_fix node if from vrep and the timestamp of chatter node is from other ros package.

https://drive.google.com/file/d/0B1taLP ... sp=sharing
Cheers

fferri
Posts: 681
Joined: 09 Sep 2013, 19:28

Re: vrep ros interface timestamp

Post by fferri »

The 'time' field of the Header msg must be a floating point value, which is interpreted as seconds by the RosInterface plugin.

You can set that field to whatever [time] you want.

If you leave it blank (or explicitly set it to 0.0), it will be sec=0 nsec=0, which has a special meaning for certain ROS nodes, such as RViz.

If you want it to be the current system time, set it to simGetSystemTimeInMs(-2)*1e-3.

If you want to be something else, e.g. synchronized with the stamp of another topic, make a subscriber in V-REP and store the stamp value of the message received in the other topic, which you will then use for publishing your topic.

How are you setting the msg.header.stamp field?

hypnosfeel
Posts: 22
Joined: 03 Mar 2014, 16:05

Re: vrep ros interface timestamp

Post by hypnosfeel »

fferri wrote:The 'time' field of the Header msg must be a floating point value, which is interpreted as seconds by the RosInterface plugin.

You can set that field to whatever [time] you want.

If you leave it blank (or explicitly set it to 0.0), it will be sec=0 nsec=0, which has a special meaning for certain ROS nodes, such as RViz.

If you want it to be the current system time, set it to simGetSystemTimeInMs(-2)*1e-3.

If you want to be something else, e.g. synchronized with the stamp of another topic, make a subscriber in V-REP and store the stamp value of the message received in the other topic, which you will then use for publishing your topic.

How are you setting the msg.header.stamp field?
Hello, fferri,

Thank you very much for the reply and your excellent new vrep ros interface. I set it to simGetSystemTime, which gets the same result with your simGetSystemTimeInMs(-2)*1e-3 method.

There is still a big difference between the timestamp generated by ros::Time:now() in normal ros package and the vrep ros timestamp. You can check the result here: https://drive.google.com/file/d/0B1taLP ... sp=sharing

This will affect the tf tree and synchronizing callback function(from message filter) of ros messages somehow. Is there any way to assign the ros::Time::now() type timestamp without subscribing another topic?

Cheers

fferri
Posts: 681
Joined: 09 Sep 2013, 19:28

Re: vrep ros interface timestamp

Post by fferri »

Ok, I understand. I added a new simExtRosInterface_getTime() function to wrap ros::Time::now(). Try pulling latest changes from v_repExtRosInterface and v_repStubsGen, and rebuild the RosInterface plugin.

hypnosfeel
Posts: 22
Joined: 03 Mar 2014, 16:05

Re: vrep ros interface timestamp

Post by hypnosfeel »

fferri wrote:Ok, I understand. I added a new simExtRosInterface_getTime() function to wrap ros::Time::now(). Try pulling latest changes from v_repExtRosInterface and v_repStubsGen, and rebuild the RosInterface plugin.
Hi fferri,

Now it works. Thank you very much!

Cheers

hypnosfeel
Posts: 22
Joined: 03 Mar 2014, 16:05

Re: vrep ros interface timestamp

Post by hypnosfeel »

fferri wrote:Ok, I understand. I added a new simExtRosInterface_getTime() function to wrap ros::Time::now(). Try pulling latest changes from v_repExtRosInterface and v_repStubsGen, and rebuild the RosInterface plugin.
Hello fferri,

Your repo is working with the new ros time function now. But the vrep_ros_interface seems not working with customized ros messages. When I add a new customized ros message to messages.txt file and build it, the warning messages come out: bad message.
When I try to use the customized messages after compiling, I get lua runtime errors in vrep.


Cheers

fferri
Posts: 681
Joined: 09 Sep 2013, 19:28

Re: vrep ros interface timestamp

Post by fferri »

Please start another thread if not related to this ROS time topic.

Also, please include details in your report (i.e. your message definition, build output, the output of `rosmsg show YourMessage`).

Most likely, your custom message cannot be found by ROS tools.

hypnosfeel
Posts: 22
Joined: 03 Mar 2014, 16:05

Re: vrep ros interface timestamp

Post by hypnosfeel »

fferri wrote:Please start another thread if not related to this ROS time topic.

Also, please include details in your report (i.e. your message definition, build output, the output of `rosmsg show YourMessage`).

Most likely, your custom message cannot be found by ROS tools.
Hi fferri,

Thank you for the advice. I get it working now.

Cheers

Post Reply