Arduino/BNO055 example code not working, "Command logs are not supported for sensors. Create the hardware Object with property 'TraceOn' disabled." error.

4 Ansichten (letzte 30 Tage)
Hey everyone,
I am having an error running the example code for using the arduino with the BNO055 sensor.
I have had to change the code slightly as I am connecting to a COM port as well as using an arduino Nano 3.
The code starts to run but then prompts me with the following error;
"Command logs are not supported for sensors. Create the hardware Object with property 'TraceOn' disabled."
I have removed and replaced the twi.h and twi.c folders at the following path (C:\ProgramData\MATLAB\SupportPackages\R2021a\aIDE\hardware\arduino\avr\libraries\Wire\src\utility) as suggested on another mathworks forum for a problem with the board but the command
a=arduino('COM5','Nano3','ForceBuild',true)
which returns the error prompt;
"Cannot program board Nano3 (COM5). Please make sure the board is supported and the port and board type are correct. For more information, see Arduino Hardware Troubleshooting."
The board is connected and at COM5 as confirmed by using:
a=arduino('COM5','Nano3','Trace',true)
I have already uninstalled/reinstalled the Arduino support package for Matlab. Still no luck.
Any advice would be greatly appreciated!
Thank you
Full example code used by me:
a = arduino('COM5', 'Nano3'); %This is the part of the code that I changed
%a = arduino('btspp://001908361009'); %Original example code
fs = 100; % Sample Rate in Hz
imu = bno055(a,'SampleRate',fs,'OutputFormat','matrix','OperatingMode','amg');
ts = tic;
stopTimer = 50;
magReadings=[];
while(toc(ts) < stopTimer)
% Rotate the sensor along x axis from 0 to 360 degree.
% Take 2-3 rotations to improve accuracy.
% For other axes, rotate along that axes.
[accel,gyro,mag] = read(imu);
magReadings = [magReadings;mag];
end
[A, b] = magcal(magReadings); % A = 3x3 matrix for soft iron correction
% b = 3x1 vector for hard iron correction
% GyroscopeNoise, AccelerometerNoise and MagnetometerNoise are determined from the BNO055 datasheet using the following formula
% NoisePower = OutputNoisePowerDensityrms^2 * Bandwidth
GyroscopeNoiseBNO055 = 3.05e-06; % GyroscopeNoise (variance value) in units of (rad/s)^2
AccelerometerNoiseBNO055 = 67.53e-06; % AccelerometerNoise (variance value)in units of (m/s^2)^2
MagnetometerNoiseBNO055 = 1; %MagnetometerNoise (variance value) in units of uT^2
viewer = HelperOrientationViewer('Title',{'AHRS Filter'});
FUSE = ahrsfilter('SampleRate',imu.SampleRate,'GyroscopeNoise',GyroscopeNoiseBNO055,'AccelerometerNoise',AccelerometerNoiseBNO055,'MagnetometerNoise',MagnetometerNoiseBNO055);
stopTimer=10;
magx_correction = b(1);
magy_correction = b(2);
magz_correction = b(3);
ts = tic;
while(toc(ts) < stopTimer)
[accel,gyro,mag] = read(imu);
% Align coordinates in accordance with NED convention
accel = [-accel(:,1), accel(:,2), accel(:,3)];
gyro = [gyro(:,1), -gyro(:,2), -gyro(:,3)];
mag = [(mag(:,1)-magx_correction), -(mag(:,2)- magy_correction), -(mag(:,3)-magz_correction)] * A;
rotators = FUSE(accel,gyro,mag);
for j = numel(rotators)
viewer(rotators(j));
end
end

Antworten (1)

Gayatri Menon
Gayatri Menon am 13 Mär. 2022
Hi,
Trace is not supported for read(imu) . Create the arduino object with 'TraceOn' set as false and then try the rest of the code, the error should not be there.
a = arduino('COM9','Uno','TraceOn',false,'ForceBuild',true);
Hope this helps
Thanks
Gayatri
  2 Kommentare
Bushra
Bushra am 16 Dez. 2023
It didn't work. I am using mpu6050 with arduino uno in matlab. and receiving this error.
Error using mpu6050_Arduino12
Command logs are not supported for sensors. Create the hardware Object with property 'TraceOn' disabled.
Please guide.
MathWorks MATLAB Hardware Team
Hi,
Can you try the following commands and check?
>> clear all
>> a = arduino('<port>','<board>','TraceOn',false,'ForceBuild',true);
Please feel reach out to our Technical Support team if you are still facing any issues
https://www.mathworks.com/support/contact_us.html
Thanks,
MATLAB Hardware Team
MathWorks

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by