Course project - localization of the robot

Dear all,

I have an idea that using the pose.pose.postion from odom to check if the robot escapes the maze in the correct way. I attempted to move the robot and measure the position but figured out it is difficult to control the robot and get the coordinate of the maze.

Are there some tools which I can easily get the coordinate of the map?


Hi Kailin,

At what speeds are you moving the robot? It will be difficult to control at high speeds. I’d recommend speeds between 0.1 and 0.5. You can increase later, if needed, after you get a hang of everything.

thank you @bayodesegun

I used speed 0.2. What is kinetic model of sphero? I found it difficult to turn it as desired.

And are there any tools by which I can get directly the coordinate of the maze (position of exit)?


Hi @kailin.tong,

Try reducing that further. The Sphero has very high inertia so that once it starts moving it’s difficult to stop. Imagine how a heavy metal ball would behave…

I don’t know of any such tool, but if your aim is to know whether the robot has exited properly, you can simply see if it jumped over the wall or not. Also, after exiting, there should be no more collisions.

Hi @kailin.tong,
you can orient yourself with the grid in gazebo. Every square has a side distance of 1. By looking at the maze, you can tell, that Sphero will have left the maze when reaching two squares distance. So you can either

  1. Just measure the distance and have it finish when the distance is larger than one.

  2. Slightly more elegant: you find out in which direction the exit is and have Sphero finish, if that coordinate is larger than 2. to find out in which direction in the world frame sphero is moving:

run in webshell 1:
rostopic echo /odom/pose/pose/position

run in webshell 2:

rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 0.05
  y: 0.0
  z: 0.0
  x: 0.0
  y: 0.0
  z: 0.0"

and then see what coordinates sphero is going to. You will see that Sphero’s y-position will become negative, while the others stay the same, so in this case Sphero is finished when

odom.pose.pose.position.y < -2

hope that helps :slight_smile: You can apply the same for the next chapter with the Turtlebot


@simon.steinmann91 thank you for your suggestion!

I forgot to use rostopic pub…
I tried to measure the maze using keyborad to control the robot and odom to get the position, this drove me crazy…



1 Like