A* seach used in an office: problem with walls

asked 2019-07-02 02:43:16 -0600

Elric gravatar image

I'm using ROS melodic and Gazebo 9.9.0 on an Ubuntu 18.04.2 LTS bionic.

I'm implementing A* on a robotic simulator to find the path from start position to goal position.

I have a question about walls.

This is the image of an office that I want to use:

image description

I have used a OpenCV program to convert it to a matrix used as input map in the A* algorithm:

int grid[14][16] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,1,0,1,1,0,1,1,1,1,0},
{0,1,1,1,1,0,1,1,0,1,1,1,1,0},
{0,1,1,1,1,1,1,1,0,1,1,1,1,0},
{0,1,1,1,1,1,1,1,0,1,1,1,1,0},
{0,1,1,1,1,0,1,1,1,1,1,1,1,0},
{0,1,1,1,1,0,1,1,1,1,1,1,1,0},
{0,1,1,1,1,0,1,1,0,0,0,0,0,0},
{0,1,1,1,1,0,1,1,0,1,1,1,1,0},
{0,0,0,0,0,0,1,1,0,1,1,1,1,0},
{0,1,1,1,1,1,1,1,0,1,1,1,1,0},
{0,1,1,1,1,1,1,1,0,1,1,1,1,0},
{0,1,1,1,1,0,1,1,1,1,1,1,1,0},
{0,1,1,1,1,0,1,1,1,1,1,1,1,0},
{0,1,1,1,1,0,1,1,0,1,1,1,1,0},
{0,1,1,1,1,0,1,1,0,1,1,1,1,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0}};

Ones are free space, and zeros are walls.

Walls take up one cell (i.e. zeros at {0,1,1,1,1,0,1,1,0,1,1,1,1,0},).

My problem is that walls take up one cell in the matrix, but in Gazebo, they don't. So, if I want to move the robot from the top left corner, when the robot is at a door, in Gazebo it will be at the corridor. It will be at the corridor because, in gazebo, walls don't take up space, but in the matrix they take up one cell.

Do you have any suggestion about how to avoid this problem? (Maybe creating walls that take up one cell space in Gazebo)

edit retag flag offensive close merge delete