How do I plot a 3D grid from a 3D matrix?

조회 수: 6 (최근 30일)
Uday Bhargav
Uday Bhargav 2021년 4월 21일
답변: Divija Aleti 2021년 6월 21일
I have a 3D matrix filled with ones and zeroes, where ones represent the cells with obstacles and zeroes represent the cells through which my UAV can pass through. How do I map this environment and the path together?

답변 (1개)

Divija Aleti
Divija Aleti 2021년 6월 21일
Hi Uday,
You can create an empty 3D Occupancy map using the occupancyMap3D function.
Then, you can use the setOccupancy object function to specify whether a given location is free or is an obstacle, using the 3D matrix you have. The syntax for this function is:
setOccupancy(map3D,xyz,occval)
Here, map3D is the 3D Occupancy map that you have created. xyz is a matrix in which each row is a 1-by-3 vector corresponding to the indices of the elements in your 3D matrix. occval is a column vector in which each element corresponds to the value of the element at that index position, that is, either zero or one.
Finally, you can display the map using the show object function.
For an example on how to use the obtained map to plan the path, refer to the following example:
Hope this helps!
Regards,
Divija

카테고리

Help CenterFile Exchange에서 Motion Planning에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by