ZMQAPI and MATLAB will warning when using step simulation

Report crashes, strange behaviour, or apparent bugs
Post Reply
CohenYue
Posts: 5
Joined: 18 Jul 2023, 03:51

ZMQAPI and MATLAB will warning when using step simulation

Post 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

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

Re: ZMQAPI and MATLAB will warning when using step simulation

Post 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

CohenYue
Posts: 5
Joined: 18 Jul 2023, 03:51

Re: ZMQAPI and MATLAB will warning when using step simulation

Post 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.

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

Re: ZMQAPI and MATLAB will warning when using step simulation

Post 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

CohenYue
Posts: 5
Joined: 18 Jul 2023, 03:51

Re: ZMQAPI and MATLAB will warning when using step simulation

Post 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~

Post Reply