I have been experimenting with a live car after taking the ros navigation course and have found a problem that I would like to ask you about.
Every time I finish building a map and prepare to start navigation, I have to manually put the cart back to the starting point of the build, otherwise, the cart cannot accurately estimate its initial position during navigation. So, my question is: Is there any way to eliminate the “manually put the cart back to the starting point” step, after all, it seems a bit redundant.
Thank you for your reply, first.
And Maybe I haven’t expressed my meaning clear in the above.
What I want to express is that I would like to know if is there a way to let the car initialize the navigation position by itself with the data obtained from its own sensors. Instead of manually or through the rviz tool putting it back.
You can localize your robot programmatically. For that you have two options (for ROS1):
Call the global_localization service. If you call that service, the particles will be distributed over the whole map and then, as the robot moves, it may localize at the proper location. This option is used when you need to localize the robot but you have no idea where it is (every time that the robot starts, it is in a different location and your program cannot identify where it will be)
Publish a position in the initalpose topic. If you know where the robot starts every time you switch it on (like for example, it starts at the charging station), you can publish that position on that topic and the AMCL will localize at that position. This is used when you know where the robot starts.
Usually, the global_localization works quite well (if the environment is not very large or very symmetrical).