LCAS / topological_navigation

The topological navigation framework
Apache License 2.0
31 stars 36 forks source link

[Legacy] ROS 1 Wiki out of date #184

Open KatherineJames opened 2 weeks ago

KatherineJames commented 2 weeks ago

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'.

KatherineJames commented 2 weeks ago

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:

Topological map file creation:

1) 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_map

Note: 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.

2) Create the .tmap2 file:

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.launch``` to use ```nav_map_yaml=my_map.yaml```

    roslaunch bacchus_slam amcl_localization.launch
    rostopic echo /clicked_point

Use 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.

1) 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:

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'"

2) 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.