Generating a 2D point cloud map

12 Ansichten (letzte 30 Tage)
Ramon
Ramon am 25 Sep. 2019
Bearbeitet: Ramon am 29 Sep. 2019
Hello there
I have to generate point clouds which represents a room or a floor, as example. Also it should be able to add an error to the generator of the point cloud to make it more real (like a noise).
With a small section of the map it should than be possible to find out the location of this small section. Like SLAM without the mapping. Just localisation.
Maybe someone has a solution or some ideas to solve this.
Kind regard
Ramon
  6 Kommentare
darova
darova am 27 Sep. 2019
Any ideas how to implement it?
Ramon
Ramon am 28 Sep. 2019
Bearbeitet: Ramon am 29 Sep. 2019
Yes, i made some functions to make lines with errors.
%% Functions
% Function for generating a line out of points with an additional random
% error for one axis
function[v_ret] = calc_v(start,fin,N,error)
dv = (fin-start)/N;
v = linspace(start,fin,N);
if dv == 0
dv = 1;
end
v_ret = v-(-error + (error+error)*rand(1,N))*dv;
end
% Function to concatenate two arrays. Returns concatenated array.
function[arr_x,arr_y] = concator(array_x,extension_x,array_y,extension_y)
arr_x = [array_x extension_x];
arr_y = [array_y extension_y];
end
% Function to add a cos-error
function[arrayWithError] = addCosError(arr,step,err_amp,err_step)
format = size(arr(1:step:end));
len = format(2);
i = linspace(1,err_step,len);
arr(1:step:end) = arr(1:step:end) + err_amp*cos(pi.*i);
arrayWithError = arr;
end
% Function for generate a point line for mapping
function [arr_x,arr_y] = setLine(x_start,x_fin,y_start,y_fin,rand_error,step_to_add_error,err_amp,err_period)
if (x_fin - x_start) > (y_fin - y_start)
N = x_fin - x_start;
else
N = y_fin - y_start;
end
arr_x = addCosError(calc_v(x_start,x_fin,N,rand_error),step_to_add_error,err_amp,err_period);
arr_y = addCosError(calc_v(y_start,y_fin,N,rand_error),step_to_add_error,err_amp,err_period);
end
The result is like this:
An example map without errors.
And the example map with errors.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ramon
Ramon am 28 Sep. 2019
  1 Kommentar
darova
darova am 28 Sep. 2019
The best solution is the solution made by yourself :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by