Hello Coppelia,
I have a problem connecting Coppelia and Matlab. I want to start the simulation from Matlab, then let a threaded child script in Coppelia do something, then, when that's finished receive some values from Matlab. While Coppelia child script is executed Matlab is in a while loop and constantly reading signal value. I tried to set a flag signal from Coppelia so Matlab will know when to start sending values. However, Matlab cannot read the correct value. I can see in Coppelia that the signal has indeed changed value, but when I read it from Matlab it still shows the old value. So instead of setting the flag in a threaded script, I tried doing it from another, non-threaded one but the same thing happened. I use synchronous mode and I tried using different operation modes in Matlab (blocking, streaming, buffer) to read the script but the same thing happened.
Does anyone have any idea as to why this happens and how I could fix it?
Cheers
Jovan
Coppelia/Matlab synchronisation
Re: Coppelia/Matlab synchronisation
Hello Jovan,
how are you trying to read the signal on the client side? And how are you setting the signal on CoppeliaSim side?
Cheers
how are you trying to read the signal on the client side? And how are you setting the signal on CoppeliaSim side?
Cheers
Re: Coppelia/Matlab synchronisation
Hi,
So on the Coppelia side, I used
sim.setIntegerSignal('flag',1)
and on the Matlab side, I used
sim.simxGetIntegerSignal(clientID, 'flag', sim.simx_opmode_blocking)
I also tried with simx_opmode_oneshot and I also tried using the combined streaming+buffer mode, but it still did not work.
Cheers
Jovan
So on the Coppelia side, I used
sim.setIntegerSignal('flag',1)
and on the Matlab side, I used
sim.simxGetIntegerSignal(clientID, 'flag', sim.simx_opmode_blocking)
I also tried with simx_opmode_oneshot and I also tried using the combined streaming+buffer mode, but it still did not work.
Cheers
Jovan
Re: Coppelia/Matlab synchronisation
There is another problem probably. Are you sure the signal is set in the script (make sur you output a print to the status bar to make sure). Also, could it be that the same signal is set from another script, or another external client, or another part of your Matlab code?
Cheers
Cheers