how to send data from matlab to CoppeliaSim

Typically: "How do I... ", "How can I... " questions
Post Reply
MaJiamu
Posts: 15
Joined: 19 Jan 2021, 03:52

how to send data from matlab to CoppeliaSim

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

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

Re: how to send data from matlab to CoppeliaSim

Post 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

Post Reply