Selecting data inside a defined area (Automated Driving)
조회 수: 1 (최근 30일)
이전 댓글 표시
This is not a question (not anymore), I've just solve this issue and I'd like to share my solution with the comunity , in case someone needs this in the future (even me!)
My task was to analyze real time data, in front of the vehicle. So I implemented the following steps:
- Define an area which is interesting to detect obstacles
- Get the real time positioning data (X, Y, Z)
- Analyze if the current data points belong to the defined area
- If they belong, classify as obstacle or not
In code lines
r = rectangle('Position',[20 -3 10 10],'EdgeColor','w');
xv = r.Position(1);
yv = r.Position(2);
% maskNotNull avoid empty values. Use only if applied to your case
% Pre-locate all variables
xq = zeros(size(maskNotNull)); % Xq is the X position
yq = zeros(size(maskNotNull)); % Yq is the Y position
z = zeros(size(maskNotNull)); % z is the z position
% other relevant variables to the obstacle detection
elevation = zeros(size(maskNotNull));
azimuth = zeros(size(maskNotNull));
RCS = zeros(size(maskNotNull));
% maskNotNull contains all the data to the current measurement
% cycle; each cycle contains several of rows to each data
for i = 1:length(maskNotNull)
% iT = cycle number
% Analyze if the current x and y are inside the rectangle
if obj.Data.x(i,iT) >= xv && obj.Data.x(i,iT) <= xv + 10 ...
&& obj.Data.y(i,iT) >= yv && obj.Data.y(i,iT) <= yv + 10
xq(i) =obj.Data.x(i,iT);
yq(i) = obj.Data.y(i,iT);
z(i) = obj.Data.z(i,iT);
is_in = [xq(i),yq(i),z(i)]
elevation(i) = obj.Data.dPhi(i,iT);
azimuth(i) = obj.Data.dTheta(i,iT);
RCS(i) = obj.Data.dRCS(i,iT);
end
end
% Calls function to evaluate if these points inside the
% rectangle are obstacle or not
rsbVis(xq, yq, z, elevation, azimuth, RCS)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Automated Driving Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!