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?
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.
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.
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
Just measure the distance and have it finish when the distance is larger than one.
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