is there any way to use a bmp file with PRM to find path planning route

Is there a way to input a .bmp file with obstacles defined into the robotics.PRM functions to define path planning ?
I can't seem to create the axis configuration I want and the non-circular obstacles using the the robotics.OccupancyGrid function and have to save a figure as a .bmp file instead. But I can't seem to get anything sensible when I pass it through the PRM path planning function.

Respuestas (2)

The .bmp file can be first converted into a binaryOccupancyMap. This map can be used as an input to the mobileRobotPRM function for finding all the possible paths.
Refer the following link for converting the Image to Binary Occupancy Grid.
The mobileRobotPRM function helps in creating the probabilistic roadmap path Planner. Refer here for more details.

7 comentarios

Hello Ajay,
firstly thanks for your fast reply - I have been looking through the binaryOccupancy documentation from your comments. I think the binaryOccupancyMap and mobileRobotPRM are in later versions of MAtLab (I am using R2017a). However I have had good success in creating a BinaryOccupancyGrid from an rgb2gray image and managed to get the PRM to find an optimum path through my obstacles.
However I have an issue in that the BinaryOccupancyGrid inserts my rgd2gray image on a World coordinate system and the path planning uses this World coordinate system as the reference. My binary image coordinate system has its zero at lower right corner - do I need to setup the World cordinate system to map onto this coordinate system or is there a conversion system that I should be using so that I can define start and end coordinates in binary image coords which translate into World coords for the PRM path following algorithm ?
If your local coordinate system has starting point on the lower right of the image, it will be easier if you flip the binary Image along the row diamension. Assume A is the binary image matrix,
flip(A,2)
Or If you want to keep the staring position on the right hand side, you can reverse the x direction of the figure
set ( gca, 'xdir', 'reverse')
Hello Ajay, thanks again for your comments - I feel that I have made some progress in understanding my issues. The main issues I have are that my map defined by BinaryOccupanyGrid is in Pixels and I have to convert the real x y coordinates when I want to inflate the map or run PRM (which works really well). I have tried to convert from the default intrinsic image coordinate system (ie Pixels) to world coordinates (ie meters) without success. Is there a way to do this so that I can directly use world coordinates (ie meters) and display them on the axes also ? Perhaps this is not possible in 2017a.
Also, I tried flipping the image and reversing the xdir and this effectively mirrored the image - what I need to do is to rotate the image 90 deg anticlockwise.
Hello William,
you could rotate 90 degrees anticlockwise using rot90
rot90 (image)
The BinaryOccupanyGrid with just map argument creates an occupancy grid with the same dimension as the image. Say the image is of 250x250, the occupancy grid matrix will be of 250x250. That is there will be one to one correspondence between the image pixel and the occupancy grid cell. Also, each pixel will correspond to 1m. That is the Binary Occupancy Grid of a 250x250 image span across an environment of 250-meter x 250-meters.
If you would like to have a different resolution for the map, define the same while creating the map
mapRes = robotics.BinaryOccupancyGrid(bwimage, 10)
Here bwimage is of dimension 250x250 and the map resolution is 10. Hence 10 pixels define 1 meter in the map. Or the resultant BianryOccupancy map will be of 25mx25m.
Hello Ajay, thanks again for your comments - I was confused about the documentation and thought that I had to convert from pixels to world coordinates but it was just a scalling factor. Thanks again for your excellent support.
hallo
i would like to ask something similar since you seem to be well informed about this thema
i have a shapefile of a garden that i want to transform into an occupancy grid map
is there any way to do that ?
thanx

Iniciar sesión para comentar.

Hello Ajay, thanks again for your comments - I was confused about the documentation and thought that I had to convert from pixels to world coordinates but it was just a scalling factor. Thanks again for your excellent support.

Categorías

Productos

Versión

R2017a

Etiquetas

Preguntada:

el 7 de Feb. de 2020

Comentada:

el 13 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by