Hokuyo URG-04LX LIDAR

1 次查看(过去 30 天)
areej abdulshaheed
areej abdulshaheed 2019-10-12
Hi.
How can I program Hokuyo URG-04LX using matlab?
I want the Lidar to do scanning inside the time loop.
The problem is that the movement of the servo motors is very slow because each 1 second the program scans, the lidar then moves the servo motor 1 step.
How can I make the movement faster?
for t=0:30
% start scanning
R=LidarScan(lidar); %Acquire the LIDAR data
for r=1:length(R) % Eliminate the longer distanced obstacles
if R(r)>RangeTol
R(r)=0;
end
end
% Find the number of obstacles in each regions
ObsRight=length(find(R(cL)>ObsTol));
ObsCenter=length(find(R(cL(end)+1:cH(1)))>ObsTol);
ObsLeft=length(find(R(cH)>ObsTol));
% end of scanning of URG-04LX
if t==0
J(1)=2048; J(2)=2048; J(3)=2048; J(4)=2048; J(5)=2048; J(6)=2048; J(7)=2048; J(8)=2048;
else
% Set the mobile to movement
if ObsCenter<MinNoObs
w=pi/4; L=pi/4; h=pi; Bo=2*pi/180; Be=0; Ae=pi/10; Ao=pi/4; w1=0; L1=pi/4;
for i=1:8
o=rem(i,2);
if o==0
Q(i)=Be+Ae*sin(i*L+w*t);
else
Q(i)=Bo+Ao*sin(i*L1+w1*t+h);
end
Q2(i)=fix(Q(i)*100);
x(i)=Q2(i)*(2048/181)+2048;
J(i)=fix(x(i));
end

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by