Page 1 of 1

Are global variables needed in ZeroMQ remote API Matlab?

Posted: 24 Mar 2024, 21:18
by andrea1999
Hello, I'm trying to make the cartpole example with reinforcement learning in Matlab simulating it on Coppelia. I'm using ZeroMQ remote API.

I have a main code and a class with some functions. Everytime I try to use API functions inside the class I get the error:
"Caused by:
Error using RemoteAPIClient/call
44: in sim.setJointTargetVelocity: one of the function's argument type is not correct."

Is that because I would have to create global variables for the arguments of the API functions? Because the same error happened with "sim.startSimulation();" but when I created the global variable "sim" it has worked.

Thank you

Re: Are global variables needed in ZeroMQ remote API Matlab?

Posted: 26 Mar 2024, 17:20
by coppelia
Hello,

make sure that sim is accessible from your code location. Making sim global is one possibility. But the error message ...one of the function's argument type is not correct. is directly caused by CoppeliaSim, not MATLAB. That means that your function call to sim.setJointTargetVelocity was successful, but decoding the correct argument was not.

Cheers