# How to use a map created with odometry

I'm using ROS Melodic with Gazebo 9 in an Ubuntu 18.04.2 LTS.

I'm studying a robotics subject at the university and I have to create a map of a closed room with one obstacle using only odometry. The idea is to know where are the obstacle and the walls to avoid them when the robot navigates to a goal position.

To do that I will do the following:

I will move the robot using the keyboard to map the entire room. I will use the odom topic from a diffdrive controller which its type is nav_msgs/Odometry and store its geometry_msgs/Pose.msg Pose data into a text file. I will store its x and y coordinates. I will filter them, and only store a new location if this new location differs from the previous one with an amount (0.1).

I can make the map autonomously using a bumper and making the robot follows a "snake" pattern. But this is not my big problem. My problem here is that I don't know how to use the map.

I've thought to use A* to move to robot to its goal. To use A* I've thought to create a 2D matrix with all the points in the text file. Each row will be the x location (I will have as many rows as many different x location I have), and the same for the rows (y location). If there is an obstacle, in the cell will be 0, and a 1 is the location is free.

I have a lot of questions but I can only ask one here:

If I want to use A*, is it correct what I did with the map?

NOTE: Beware that I'm not asking about how to do it with ROS, I'm asking if it is correct what I did with the map to allow me to use it with A*.