Selecting data inside a defined area (Automated Driving)

1 Ansicht (letzte 30 Tage)
Ana Gonçalves
Ana Gonçalves am 25 Mai 2022
Bearbeitet: Ana Gonçalves am 25 Mai 2022
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)

Antworten (0)

Kategorien

Mehr zu Environment and Clutter 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!

Translated by