Hello,
I don't want to write the code in the script of CoppeliaSim objects, but I want to write the configuration code in my project based on the ZeroMQ Remote API in Python. Is there any API that is similar to the different functions in the script, such as sysCall_actuation in the script. When setting up the inverse kinematics mode of the robotic arm, I wrote some code in this position. When I write the code in my Python project, what interface do I need to use to achieve the function similar to sysCall_actuation?
Thank you for your help.
Remote API to replace script functions
Re: Remote API to replace script functions
Hello,
when running a ZeroMQ remote API client code, then you typically do not have those system callback function, e.g. sysCall_init, sysCall_actuation, sysCall_sensing, etc, since your client code will run in a different process from CoppeliaSim, and will be relatively independent. But you can run in stepping mode, and organize your code as in following example:
Note however that your code in the:
when running a ZeroMQ remote API client code, then you typically do not have those system callback function, e.g. sysCall_init, sysCall_actuation, sysCall_sensing, etc, since your client code will run in a different process from CoppeliaSim, and will be relatively independent. But you can run in stepping mode, and organize your code as in following example:
Code: Select all
from coppeliasim_zmqremoteapi_client import RemoteAPIClient
client = RemoteAPIClient()
sim = client.require('sim')
sim.setStepping(True)
# Place your 'init' code here:
...
sim.startSimulation()
while sim.getSimulationTime() < 3:
# Place your 'actuation' code here:
...
# Place your 'sensing' code here:
...
sim.step() # triggers next simulation step
sim.stopSimulation()
- init section above will be executed in CoppeliaSim's sysCall_nonSimulation section
- actuation section above will be executed in CoppeliaSim's sysCall_actuation section
- sensing section above will also be executed in CoppeliaSim's sysCall_actuation section