[Legacy] ROS 1 Wiki out of date
Description
ROS 1 wiki is out of date. I will update the wiki in a few days under section 'Quick Topological Navigation in simulation tutorial'.
Proposed update:
Getting started tutorial in simulation (ROS 1)
A tutorial on getting started with topo-nav in ROS 1 using the Riseholme vineyard_demo and thorvald simulator.
Set up a simulation:
We have a dockerized simulation available, or please use your own: https://github.com/LCAS/bacchus_lcas/wiki/Phenorob-2021-Setting-Up
roslaunch ./vineyard_demo.launch launch_move_base:=true
Topological navigation (in simulation):
Setup simulation with topo-nav:
git clone https://github.com/LCAS/topological_navigationinto src- checkout bacchus branch for melodic (or noetic, use git branch -a)
catkin_makesudo apt-get install ros-melodic-mongodb-store ros-melodic-rospy-message-converter
Topological map file creation:
-
A metric map is required as a pre-requisite:
Resource: https://github.com/LCAS/bacchus_lcas/wiki/Phenorob-2021-Activities
Use gmapping or slam to create a metric map:
roslaunch bacchus_slam hector_slam.launch roslaunch bacchus_slam throvald_teleop.launch rosrun map_server map_saver -f my_mapNote: to navigate using teleop, you must be clicked on the terminal. Use keys to drive, i is forward,l/j make it spin.
Note2: map_saver doesn’t take too long - something may be wrong in the running of the slam script if it does. This outputs a yaml and a pgm where the line was run. Place these in bacchus_lcas/bacchus_slam/maps.
-
Create the
.tmap2file:We now need to collect x,y,z positions for nodes and create .tmap2 file:
Update
~/row_ws/src/bacchus_lcas/bacchus_slam/launch/amcl_localization.launchto usenav_map_yaml=my_map.yamlroslaunch bacchus_slam amcl_localization.launch rostopic echo /clicked_pointUse the Publish Point tool in Rviz to click where you want nodes, these will be output to the terminal.
Copy the template from: https://github.com/LCAS/environment_common/blob/main/environment_common/convertors/templating/tmap.py
Modify this file to use the node values you have just received from /clicked_point. The first line should be meta: Note: {location} and {gentime} can be any strings and this file is EXTREMELY case and space sensitive!
Launch and visualise the topological map
Modify vineyard_demo.launch to use my_map.yaml.
- View topological map in Rviz
Then:
roslaunch ./vineyard_demo.launch launch_move_base:=true
rosrun topological_navigation map_manager2.py demo.tmap2 # publishes the file to a rostopic
rosrun topological_navigation topological_transform_publisher.py
rosrun topological_navigation visualize_map2.py
In Rviz:
- Add markerarray: topological_map_visualisation
- Add markerarray: topological_route_visualisation
- NB: if you messed up the positions, they may be off the map.
- Add interactivemarkers for go_to_node/update (add direction arrows to the nodes)
You can add edges:
rosservice call /topological_map_manager2/add_edges_between_nodes “
origin: node0
destination: node1
action: move_base
edge_id: stringid”
If edges should be bi-directional, another edge will need to be added with origin: node1, destination: node0.
And save the updates: rosservice call /topological_map_manager2/write_topological_map "filename: '`pwd`/updated.tmap2'"
-
Use the topological map for navigation:
rosrun topological_navigation localisation.py rosrun topological_navigation navigation.py
Clicking on the interactive markers should now produce a path along the edge, and the robot should move from one node to the other.