Page 1 of 1

ZMQAPI and MATLAB will warning when using step simulation

Posted: 04 Jan 2024, 07:02
by CohenYue
hi,
I'm trying to use matlab to control vrep by zmq. When I simulation in step mode, and make breakpoint in matlab,there will be a waring in vrep.
I had try to use the example scene and code. I had use the pController.m and the scene.

When I'm running the code and set a breakpoint. The warning window will appear,
"Connectivity >> ZMQ remote API server@addOnScript: abort execution".
And there will be a warining in command lineļ¼š"[CoppeliaSim:warning] Detected non-default settings (time steps and/or dyn. engine global settings)."

And some times, the coppeliasim will crash..

Addition: I'm trying to use version 4.6

Re: ZMQAPI and MATLAB will warning when using step simulation

Posted: 04 Jan 2024, 16:33
by coppelia
Hello,

the warnings you are seeing are normal: when blocking the ZeroMQ remote APi client, CoppeliaSim will wait until unblocked. Try setting the breakpoints outside of a communication loop, i.e. somewhere where CoppeliaSim API functions are not called.

The other warning is also normal if running with non-standard parameters (as is the case with the pControllerViaRemoteApi.ttt scene).

If there is a crash, please provide a minimalistic, self-sufficient scene that we can use to reproduce the crash, or describe precisely how we can reproduce the crash.

Cheers

Re: ZMQAPI and MATLAB will warning when using step simulation

Posted: 05 Jan 2024, 02:38
by CohenYue
Thanks for your reply.

The reason I set the breakpoint in the communication loop is because I want to observe the values of the variables at a particular simulation time step.

I have tried to use the simulation step that comes with Coppeliasim, but when I used it, I couldn't set breakpoints and observe variable values when MATLAB continued to run.

If I set the breakpoint somewhere outside of the communication loop, there is no way to pause the simulation and observe the variable values.

Re: ZMQAPI and MATLAB will warning when using step simulation

Posted: 05 Jan 2024, 07:06
by coppelia
you can step/pause the simulation yourself from MATLAB, when running in stepping mode, e.g.:

Code: Select all

sim.setStepping(true);
sim.startSimulation();
while 1
    t = sim.getSimulationTime();
    if t >= 3; break; end
    s = sprintf('Simulation time: %.2f [s] (simulation running synchronously to client, i.e. stepping)', t);
    fprintf('%s\n', s);
    sim.addLog(sim.verbosity_scriptinfos, s);
    sim.step();  % triggers next simulation step
end
sim.stopSimulation();
in above, as long as you do not call sim.step(), then simulation will not advance.

Additionally you can also use the simulation stepper add-on if you want to trigger each simulation step manually: [Menu bar > Modules > Tools > Simulation stepper]

Cheers

Re: ZMQAPI and MATLAB will warning when using step simulation

Posted: 08 Jan 2024, 03:04
by CohenYue
Thanks for your reply.

I got your point. I need not to care the yellow warning window, Just run stepping mode like the previous version.

Thank you very much~