V-REP ROS Plugin get wrong rostime when I use simulation time

Typically: "How do I... ", "How can I... " questions
Post Reply
flighy
Posts: 1
Joined: 15 Mar 2021, 13:37

V-REP ROS Plugin get wrong rostime when I use simulation time

Post by flighy »

Hi, I use V-REP with ROS in Ubuntu 16.04.
I want to get V-REP simulation time by ROS topic, so I use 'use_sim_time' parameter as 'true.'
So, I can get simulation time by using 'ros::Time::now()' in my own ros node(This node is not depend on V-REP).
However, in V-REP script, 'simROS.getTime()' return ROS wall time(system time), not simulation time.
According to description of simROS.getTime(), this function return the current ROS time (i.e. the time returned by ros::Time::now()). (Ref : https://www.coppeliarobotics.com/helpFi ... tm#getTime)
Could anyone explain me why these functions are different?
Thanks.

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

Re: V-REP ROS Plugin get wrong rostime when I use simulation time

Post by fferri »

Hi,

Yes, simROS.getTime() returns the value in seconds of ros::Time::now() as described in the API reference. Which functions are different?

If you need the simulation time, there's a different API for that: sim.getSimulationTime().

If you want to use simulation time as the ROS clock source, you can achieve that by publishing to the clock topic. See Running a Clock Server.


Cheers

Post Reply