How to get sensor data of Accerometer and GyroSensor in MATLAB?

Typically: "How do I... ", "How can I... " questions
Post Reply
ChiChi
Posts: 1
Joined: 23 Apr 2024, 10:28

How to get sensor data of Accerometer and GyroSensor in MATLAB?

Post by ChiChi »

Dear Coppeliasim,

Thank you for your effort in this field. Now a have some problems in using ZMQremoteAPI to get the sensor data of Accerometer and GyroSensor in Matlab.

I try to use this code in LUA Scripts:

Code: Select all

sim.setFloatSignal("accel1",accel[3])
and use these codes in Matlab .m file:

Code: Select all

signalValue = sim.getFloatSignal("accel1");
but I got an error in Matlab:

Code: Select all

When calling "RemoteAPIObject/subsref," no value was assigned to the output argument "varargout{1}" (possibly including other arguments).

Error occurred in testvrep (line 10)
signalValue = sim.getFloatSignal("accel1");
I am not exactly know how to use set and get Signal function to get the variable desgin by userself, between Coppe and Matlab. Do you have any Samples?

By the way, do we have the ZMQremoteAPI handbook for Matlab style? Online or Offline both Okay.

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

Re: How to get sensor data of Accerometer and GyroSensor in MATLAB?

Post by coppelia »

Hello,

the error very probably happens because the signal is not set (yet), and the call to sim.getFloatSignal returns nothing. So you can't assign nothing to a variable in MATLAB. Use a try-catch block to handle a possibly non-existing return value.

Cheers

Post Reply