Velodyne Acoustics HDL-64E S2.1 user manual APPendix d MatLaB saMPLe code

Page 23

aPPendix d: MatLaB saMPLe code

HDL-64E S2 and S2.1 User’s Manual

Matlab sample code to read calibration data from HDL-64E output.

fileFilter = '*.pcap'; [File_name,Directory]=uigetfile(fileFilter,'Open a .pcap file') ;

Filename=[Directory File_name];

tic;

fid=fopen(Filename);

ttc=fread(fid,40);

ttc=fread(fid,42);

ttc=fread(fid,inf,'1206*uint8=>uint8',58);

%ttch=dec2hex(ttc);

%Determine how many data packets. Packet=size(ttc)/1206;

% Convert data to single precision. S1=single(ttc(2,:))*256+single(ttc(1,:)); S2=single(ttc(102,:))*256+single(ttc(101,:)); S3=single(ttc(202,:))*256+single(ttc(201,:)); S4=single(ttc(302,:))*256+single(ttc(301,:));

for i=0:10000 % Packets loop

status(i+1)=(ttc(1205+i*1206));

value(i+1)=(ttc(1206+i*1206)); end

a=[85 78 73 84 35] fclose(fid);

toc;

Ind=strfind(value,a);

%Loop through 64 lasers.

for i=1:64 temp=single(value(Ind(1)+64*(i-1)+16:Ind(1)+64*(i-1)+16+7)); temp1=single(value(Ind(1)+64*(i-1)+32:Ind(1)+64*(i-1)+32+7)); temp2=single(value(Ind(1)+64*(i-1)+48:Ind(1)+64*(i-1)+48+7)); temp3=single(value(Ind(1)+64*(i-1)+64:Ind(1)+64*(i-1)+64+7)); LaserId(i)=temp(1);

%Add high and low bytes of Vertical Correction Factor together and check if positive or negative correction factor.

VerticalCorr(i)=temp(3)*256+temp(2); if VerticalCorr(i)>32768

VerticalCorr(i)=VerticalCorr(i)-65536;

End

%Scale Vertical Correction Factor by Diving by 100. VerticalCorr(i)=VerticalCorr(i)/100;

[ 20 ]

Image 23 Contents
E R ’ S M a N U a L a N D HDL-64E S2 and S2.1Last Six Bytes Examples Front/Back Mounting Side Mounting Top Mounting WiringBox Reading Calibration and Sensor Parameter DataPage Box IntroductionS2.1 HDL-64E S2 design overview PrinciPLes of oPerationFront/Back Mounting InstaLLation oVerVieWSide HDL mounting illustration Side MountingTop HDL mounting illustration Top MountingDevelop Your Own Application-specific Point-cloud Viewer WiringUsaGe Use the Included Point-cloud ViewerParameter Unit Description Values Establish communication with the sensorDb.xml Calibration Parameters Sample SERCMD.txt file Change Run-Time ParametersSample Batch File .bat Command Description Parameters Available commandsLimit Horizontal FOV Data Collected Control Spin RateExternal GPS Time Synchronization Define Sensor Memory IP Source and Destination AddressesDestination Upload Calibration DataGPS Equipment Laser Firing Sequence and Timing Packet Format and Status Byte for GPS Time StampingTime Stamping Accuracy Rules GPS Connection Timestamp Info AccuracyHDL software update screen capture FirMWare uPdateAPPendix a MechanicaL draWinGs Isometric View APPendix B WirinG diaGraM Digital Sensor Recorder DSR InstallAPPendix c diGitaL sensor recorder dsr Click the Record button APPendix c diGitaL sensor recorder dsrRotational ZoomAxis Rotation ShiftAPPendix d MatLaB saMPLe code APPendix d MatLaB saMPLe code Status Type Ascii Value Interpretation and Scaling Data Packet Format APPendix e data PacKet forMatFirmware version 4.07 sheet 1 Firmware version 4.07 sheet 2 Firmware version 4.07 sheet 3 Last Six Bytes Examples 40 = Ver Packet #7658 Packet #7657Coordinate Calculation Algorithm Sample Code APPendix f duaL tWo Point caLiBration MethodoLoGyDual Two Point Calibration Methodology and Code Samples APPendix f duaL tWo Point caLiBration MethodoLoGy Intensity Value Corrected by Distance Code Intensity Compensation vs DistanceCalibration Window APPendix f duaL tWo Point caLiBration MethodoLoGy HDL-64E Ethernet Timing Table Overview APPendix G ethernet transit tiMinG taBLeLaser Numbers 0-7 & 32-39 Lower,Upper How to use this table The table represents a sensorAPPendix h Laser and detector arranGeMent RPM RPS APPendix i anGuLar resoLutionSerVice and Maintenance TrouBLeshootinGProblem Resolution SPecifications Velodyne LiDAR, Inc