How to synchronize my control with the simulation ?

Typically: "How do I... ", "How can I... " questions
Post Reply
NicoleChen
Posts: 3
Joined: 27 Apr 2017, 17:29

How to synchronize my control with the simulation ?

Post by NicoleChen »

Hi,

I' m using simRosSynchronous and simRosSynchronousTrigger service to make sure that simulation just run one step every time. And I found that after calling SynchronousTrigger, the simulation cannot be paused by simRosPauseSimulation.

Do you have any tips?

Cheers,
Nicole

NicoleChen
Posts: 3
Joined: 27 Apr 2017, 17:29

Re: How to synchronize my control with the simulation ?

Post by NicoleChen »

After trial and errors, I finally figured it out. The steps I followed are:

a. Synchronous(True) by the simRosSynchronousTrigger service
b. Start_simulation() by the simRosStartSimulation service
c. SynchronousTrigger() by the simRosSynchronousTrigger service
d. Loops of my own program util the it finishes
e. Synchronous(False) by the simRosSynchronousTrigger service (this is important, otherwise no service can be done)
f. Pause_simulation() by the simRosPauseSimulation service

To stop or pause, I need to close the synchronize mode if I trigger the synchronize mode before I want to stop or pause.

I still don't know why. I have not found any explanation from the website:
http://www.coppeliarobotics.com/helpFil ... ynchronous

Do you have any idea?

Thank you.

Nicole

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

Re: How to synchronize my control with the simulation ?

Post by coppelia »

Hello Nicole,

it seems you are using the old ROS plugin for V-REP: that plugin is not flexible, confusing, difficult to extend, and will not be updated in future. We highly recommend to use the new RosInterface instead.
When working with the RosInterface, you can use a helper tool located in Models/tools/rosInterface helper tool.ttm: this will allow you to run in synchronous mode. At the same time, you will be able to easily modify the customization script attached to that helper tool, in order to adjust the behaviour to your own needs.

Cheers

Post Reply