% The aim is to build an obstacle environment for the mobile robot to% traverse and plan its motionclc;clear;y=12;x=12;% creating an empty world of one'semptyWorld=zeros(int32(180/y),int32(180/y));size(emptyWorld)% rows=21 col=21emptyWorld;% 1 - Obstacle centeremptyWorld(8,8)=1;% -------------------------------------% 2 - Obstacle end-points% -------------------------------------fori=1:7:15forj=15:-7:1emptyWorld(i,j)=1;endend% -------------------------------------% 3 - Obstacle "V"% -------------------------------------v1={3,4,5};v2={3,5};fori=1:numel(v1)forj=1:numel(v2)emptyWorld(v1{i},v2{j})=1;endendemptyWorld(6,4)=1;% -------------------------------------% 4 - Obstacle "E"% -------------------------------------e1={10,11,12,13,14};e2={4,5};fori=1:numel(e1)emptyWorld(e1{i},3)=1;endfori=1:2:numel(e1)forj=1:numel(e2)emptyWorld(e1{i},e2{j})=1;endend% -------------------------------------% 5 - Obstacle "D"% -------------------------------------d1={3,4,5,6};d2={11,12};fori=1:numel(d1)emptyWorld(d1{i},10)=1;endfori=1:3:numel(d1)forj=1:numel(d2)emptyWorld(d1{i},d2{j})=1;endendfori=2:numel(d1)-1emptyWorld(d1{i},13)=1;end% -------------------------------------% 6 - Obstacle "A"% -------------------------------------fori=1:numel(e1)emptyWorld(e1{i},10)=1;emptyWorld(e1{i},13)=1;endfori=1:2:numel(e1)-2forj=1:numel(d2)emptyWorld(e1{i},d2{j})=1;endend% -------------------------------------% 7 - Final Obstacles% -------------------------------------f1={4,5,11,12};fori=1:numel(f1)emptyWorld(f1{i},8)=1;emptyWorld(8,f1{i})=1;endsaveenvironmentimshow(emptyWorld)axisongridongridminor