Matlab Mobile - Extracting my sensor data isnt working properly.

조회 수: 8 (최근 30일)
Daniel Hauch
Daniel Hauch 2017년 10월 26일
댓글: Bushra 2023년 12월 16일
Hello all,
i am working with matlab mobile and i am facing a rather annoying problem. I dont even know if it is caused by Matlab Mobile/Matlab/Android or my Smartphone. I work with Matlab R2016a.
After i have created a successful connection between the smartphone and matlab and logged some data, i want to extract it via [Accel, t_Accel] = accellog(m). But the results i get seem to be corrupt/broken. The timevector isnt contiguous and i receive too few data. If i shake my phone for like 15 seconds and the contiguous party of timevec imply a frequency of ~12 Hz my Datamatrix is only 70x3 and not ~180x3 as i would expect.
Does anyone of you know where my problem occurs from? I tested 2 different smartphones and controlling matlab mobile on the smartphone and in matlab with console commands (m.Logging =1 ; m.Logging =0;) and i still get similar problems.
I hope someone has a smart idea.
Greetings

답변 (1개)

Daniel Hauch
Daniel Hauch 2017년 10월 30일
I fixed the problem!
If anyone is interested, i will write a quick report.
Making timevector contiguous: delete old mobiledev and create a new one. I dont know why this problem occurs, but this is a simple fix.
Receive logged data completly: Matlab Mobile needs quite some time to postprocess the logged data. Therefore you have to wait some time until the log-functions return vectors with the appropiate length. I automated this process with the code showing below:
t_Accel_old = 0;
while true
%get data from mobiledev and save in var
[Accel, t_Accel] = accellog(m);
if length(t_Accel_old)==length(t_Accel)
break;
end
t_Accel_old = t_Accel;
pause(2);
end
I hope my explanation is helpful and saves someone some time.
Greetings
  댓글 수: 1
Bushra
Bushra 2023년 12월 16일
clc;
clear all;
clear a;
a = arduino('COM5', 'Uno');
fs = 100; % Sample Rate in Hz
imu = mpu6050(a,'SampleRate',fs,'OutputFormat','matrix');
ts = tic;
stopTimer = 50;
magReadings=[];
while(toc(ts) < stopTimer)
[accel,gyro] = read(imu);
end
GyroscopeNoiseMPU9250 = 3.0462e-06; % GyroscopeNoise (variance value) in units of rad/s
AccelerometerNoiseMPU9250 = 0.0061; % AccelerometerNoise (variance value) in units of m/s^2
viewer = HelperOrientationViewer('Title',{'AHRS Filter'});
FUSE = ahrsfilter('SampleRate',imu.SampleRate, 'GyroscopeNoise',GyroscopeNoiseMPU9250,'AccelerometerNoise',AccelerometerNoiseMPU9250);
stopTimer = 100;
ts = tic;
while(toc(ts) < stopTimer)
[accel,gyro] = read(imu);
% Align coordinates in accordance with NED convention
accel = [-accel(:,2), -accel(:,1), accel(:,3)];
gyro = [gyro(:,2), gyro(:,1), -gyro(:,3)];
rotators = FUSE(accel,gyro);
for j = numel(rotators)
viewer(rotators(j));
end
end
I am reading data from mpu6050 using arduino in MATLAB. I am receiving this error
Error using mpu6050_Arduino12
Command logs are not supported for sensors. Create the hardware Object with property 'TraceOn' disabled.
Can you help me with that?

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  원격 교육 커뮤니티

카테고리

Help CenterFile Exchange에서 Sensor Data Collection에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by