Intro
Posting on some results related to working with Gazebo + RViz. The task at hand was importing a new world model into gazebo, building a map, and using localization and navigation packages to allow for the Turtlebot to navigate to a given target. I am currently working on a larger project, as part of my work at Idein Inc. which requires data generated from simulation, thus my venture into Gazebo + RViz.
The general feeling I have is that RViz + Gazebo is not so friendly to a new comer, and requires a decent amount of head banging to get things to work. That said, since we are dealing with a lot of moving parts, the complexity of the system and the API should be somewhat expected. To consider that this is the case after ALOT has already been abstracted is quite impressive.
source: https://github.com/surfertas/turtlepi
Map Generation
Gazebo has a build
editor
which allows one to create a “world”. This will clearly come in use at some
point later, but considering the time constraints, instead of creating a new
world model, I relied on models created by erlerobot found
here.
The model.config
, and model.sdf
were placed into a directory called /circuit2
and
this was placed in ~./gazebo/models
. The circuit2.world
file was placed in the
/worlds
directory under a ros package that I created called turtlepi_gazebo
, which
allows for easier access by other programs.
Now that we have a world environment we can generate a map.
generate_map.launch
, was constructed to handle the launch of files related to teleop, gmapping, and RViz.
After a painstakingly manual task of teleoping the turtlebot around, we get two
outputs, a .pgm
image, and a .yaml
file referencing the .pgm
image. In
term of steps:
$ roslaunch generate_map.launch
Use the teleop keypad to move around the map. You can confirm the construction of the map in RViz which should have loaded as a result of roslaunch.
Once you are satisfied with the constructed map, run map_server.
$ rosrun map_server map_saver -f <file_name_to_save_to>
You should now see the previously mentioned files generated.
Localization
This is really all we need to see the turtlebot in action, localizing and navigating its way based on the generated map and given target.
$ rosrun turtlepi_localize.launch map_file:=<location_of_.yaml_file>
Not sure for others, but it took awhile for the map to load and set up which in the meantime ROS was streaming the following warning:
[ WARN] …:Timed out waiting for transform from base_footprint to map to become
available before running costmap, tf error:…
Setting the Global options-> Fixed Frame from map
to base_link
resolved the
issue. (Though subsequently flipping back made the localization and navigation
task function seemingly better)
Results
Thoughts
I am just happy I got this working, but clearly a lot of road blocks ahead.
References
- http://gazebosim.org/tutorials?cat=build_world&tut=building_editor
- http://learn.turtlebot.com/2015/02/03/8/
- https://github.com/erlerobot/gym-gazebo/blob/master/gym_gazebo/envs/assets/worlds/circuit2.world