Delay between receiving new object position & animation

Typically: "How do I... ", "How can I... " questions
Post Reply
jessica
Posts: 10
Joined: 06 Oct 2015, 16:03

Delay between receiving new object position & animation

Post by jessica »

Hi,
I'm trying to build a simulator using VREP. A problem that occured is that:
I have a vision sensor publisher enabled inside the child script of this vision sensor, and I have a subscriber in ros listenning to this topic: sub_cam_img_.
I then have a service in ros, when called, it will first retrieve the latest frame from the sub_cam_img_, I call it "s1", then it will publish a new position for the object in vrep, then get a new frame of the changed object configuration, called "s2".
The thing is that I found that everytime the s1 and s2 are the same, they are all of the configuration before the change. I add some control in my code so I can make sure that the s2 is the frame right after the new position is published to vrep. So apprently there is a delay between the publish of the new position & the animation of that change.
Is there any way that I can get an estimate of this delay? Or other mechanisms that I can know when an object changed its position, so that I can get the frame only after this change?
Thanks in advance!

coppelia
Site Admin
Posts: 10413
Joined: 14 Dec 2012, 00:25

Re: Delay between receiving new object position & animation

Post by coppelia »

Hello Jessica,

when controlling a simulation from an external application (e.g. ROS or the remote API), then it is fully normal that you have delays, since the two processes need to exchange and execute/apply them. First, have a look how the ROS messages are handled in a simulation loop, here, at the bottom of the page.

The info topic allows you to retrieve the simulation time. Then, depending on the streamed topics, you sometimes also have a time stamp available.

Have also a look at following two services, that allow you to run V-REP in synchronous mode:
Cheers

jessica
Posts: 10
Joined: 06 Oct 2015, 16:03

Re: Delay between receiving new object position & animation

Post by jessica »

Thanks!

Post Reply