Lidar diver serial warning
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I'm using hokuyu URG-04LX lidar and trying to get data on matlab. I've used lidar driver in mathworks but I got an error "A timeout occurred before the Terminator was reached.'serial' unable to read all requested data. For more information on possible reasons, see Serial Read Warnings." The code I got from mathwork is
% Setup Lidar
% % Configures Serial Communication and Updates Sensor Communication to
% SCIP2.0 Protocol.
% % Checks Version Information and switches on Laser.
% Author- Shikhar Shrestha, IIT Bhubaneswar
lidar=serial('COM3','baudrate',115200);
set(lidar,'Timeout',0.1);
set(lidar,'InputBufferSize',40000);
set(lidar,'Terminator','CR');
fopen(lidar);
pause(0.1);
fprintf(lidar,'SCIP2.0');
pause(0.1);
fscanf(lidar);
fprintf(lidar,'VV');
pause(0.1);
fscanf(lidar)
fprintf(lidar,'BM');
pause(0.1);
fscanf(lidar)
----------------------------------------------------------------------------------------------------------------
% Get a LIDAR Scan
% Returns a range vector of 682 elements after a Lidar Scan from min step
% to max step.
% Range Values correspond from -120 to +120 degrees.
% Author- Shikhar Shrestha, IIT Bhubaneswar
function [rangescan]=LidarScan(lidar)
proceed=0;
while (proceed==0)
fprintf(lidar,'GD0044072500');
pause(0.1);
data=fscanf(lidar);
if numel(data)==2134
proceed=1;
end
end
i=find(data==data(13));
rangedata=data(i(3)+1:end-1);
for j=0:31
onlyrangedata((64*j)+1:(64*j)+64)=rangedata(1+(66*j):64+(66*j));
end
j=0;
for i=1:floor(numel(onlyrangedata)/3)
encodeddist(i,:)=[onlyrangedata((3*j)+1) onlyrangedata((3*j)+2) onlyrangedata((3*j)+3)];
j=j+1;
end
for k=1:size(encodeddist,1)
rangescan(k)=decodeSCIP(encodeddist(k,:));
end
end
How can I get rid of warning?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Labeling, Segmentation, and Detection finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!