How to use a map created with odometry

asked 2019-04-17 10:50:25 -0600

Elric gravatar image

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:

  1. 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 here:

  1. If I want to use A*, is it correct what I did with the map?
  2. How can I know where is the robot in the map? Maybe I can use tf to create a world frame and instead of storing odometry data, I can "translate it" to the world frame.
  3. How can I use the map with A*?
edit retag flag offensive close merge delete