Page 1 of 1

how to send data from matlab to CoppeliaSim

Posted: 29 Mar 2024, 04:03
by MaJiamu
Hello, I connect the Matlab and CoppeliaSim with ZMQ Remote API. And it is really easy to coding in matlab with lua API function to control the object in CoppeliaSim.

However, I was wondering about the way to send data from matlab to CoppeliaSim. In this way, I can calulate the configuration result in matlab and then I send the configuration result as data to CoppeliaSim, and CoppeliaSim will performs under the configuration result.
I know that I can directly code in matlab to directly control the Object in CoppeliaSim, but I hope that the code of control Object can be completed in CoppeliaSim.
By the way, I hope the frequency of data transmission is synchronized with matlab.

I hope someone can help me. Thank you very much!

Re: how to send data from matlab to CoppeliaSim

Posted: 02 Apr 2024, 08:06
by coppelia
Hello,

to send data over to CoppeliaSim, simply call sim.callScriptFunction and make sure you have an appropriate script function in the Lua script to receive and process the data. Also make sure that the script is initialized at the time it is called from MATLAB.
By the way, I hope the frequency of data transmission is synchronized with matlab
You want to use the stepping mode.

Cheers