Where I am in a resized occupancy grid?

Hi, I'm working on my first task in ROS and ran into a problem implementing the following algorithm:

These are the asumpsions we have: You can assume the following about the environment and the robot's movement: • Approximate cellular decomposition – the environment can be decomposed into a collection of uniform grid cells, each cell of size D. • The robot can move only in four compass directions - East, West, South and North. • The robot has perfect localization. • The robot has a circular shape, whose diameter is equal to the cell size D. • The starting location will not be on an obstacle the goal can be on an obstacle. In this case the end goal should be in the last step of the path to the goal that is not an obstacle.

The main steps of the algorithm are: 1) Load the occupancy grid map by calling the static_map service. 2) Switch to a grid, where each cell is equal to the size of the robot D. To avoid collisions of the robot with obstacles, if one of the subcells in a given grid's cell is occupied then mark the entire cell as occupied. 3) Find all the free cells that are reachable from the robot's initial position and ignore all the other cells. 4) Print a path of grid cells (in the D size grid) from the starting location to the end location. You can find this path with any search algorithm you want.

Input: The algorithm is given the map of the environment as a .pgm file (as an argument in the launch file) and the robot diameter size (as a parameter in the launch file) and the starting and end location of the robot (also given as a parameter in the launch file). For testing, you can use the map playground.pgm from turtlebot_gazebo/maps.

Output: Your application should generate two output files: 1. new_grid.txt - The new coarse grid 2. path.txt – the path from the starting position to the goal.

My problem: I read here that in order to get the occupancy grid location of my robot I should preform this calculation: https://answers.ros.org/question/1026... But in my case I don't know what my resolution should be, because my grid is resized in a way that each cell size is approximately diameter size. for example, here are some of my calculations for this project:

'''Returns the resize factor of the grid according to the argument robot
diameter (D) and the map's resolution.'''
def get_resize_factor(robot_diameter, my_map):
return int( ceil( robot_diameter / my_map.info.resolution))

'''Returns the diameter (D) cell sized grid dimension sizes, the height and the
width, according to the argument resize factor. '''
def get_diameter_grid_dimension_sizes(resize_factor, my_map):
diameter_grid_height = int( floor( my_map.info.height / resize_factor))
diameter_grid_width = int( floor( my_map.info.width / resize_factor))
return diameter_grid_height, diameter_grid_width

edit retag close merge delete

Sort by » oldest newest most voted

I don't know what my resolution should be, because my grid is resized in a way that each cell size is approximately diameter size

You've just given the definition of the resolution of an occupancy grid : it's the size of each cells in the occupancy grid. So your resolution is robot_diamater.

more