Accessing Coppelia script functions via ZeroMQ

Typically: "How do I... ", "How can I... " questions
Post Reply
javl0p
Posts: 25
Joined: 24 Mar 2023, 10:42

Accessing Coppelia script functions via ZeroMQ

Post by javl0p »

Hi!

I am currently using the ZeroMQ remote API to access and control a Coppelia scene through a Python application.

I was wondering if it would be possible to access functions that are defined within customization and child scripts contained in the scene.

I am using Coppelia v4.6.0.

Thank you!
fferri
Posts: 1334
Joined: 09 Sep 2013, 19:28

Re: Accessing Coppelia script functions via ZeroMQ

Post by fferri »

Yes, via sim.callScriptFunction you can call a function defined in a child or customization script. (in case of child script, the simulation must be running)
javl0p
Posts: 25
Joined: 24 Mar 2023, 10:42

Re: Accessing Coppelia script functions via ZeroMQ

Post by javl0p »

Thanks for the answer.

Specifically, we are trying to access a function that is stored within a threaded child script.

The problem is, we are trying to unit test each of these functions. For that purpose, the simulation must start (so that the child script is initialized).

What we are doing is starting the simulation from the Python application and then calling the function contained in our threaded child script, but that doesn't seem to work since the simulation halts and the function does not return anything.

Thank you in advance!
fferri
Posts: 1334
Joined: 09 Sep 2013, 19:28

Re: Accessing Coppelia script functions via ZeroMQ

Post by fferri »

When the simulation stops, child scripts are destroyed.

You have to keep simulation running if you wish to call functions of a threaded child script.
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Accessing Coppelia script functions via ZeroMQ

Post by coppelia »

Maybe try using a threaded customization script instead? Those won't stop when simulation stops.

Cheers
javl0p
Posts: 25
Joined: 24 Mar 2023, 10:42

Re: Accessing Coppelia script functions via ZeroMQ

Post by javl0p »

I didn't manage to access the functions within the childscripts so we found a workaround to test those functions separately. i will keep you updated if we find a better solution.

Thanks for the support!
Post Reply