introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
957 stars 556 forks source link

How to add new nodes in the pose graph #776

Open an99990 opened 2 years ago

an99990 commented 2 years ago

Hi, I would like to add new nodes in the pose graph, like landmarks How do I achieve that with rtabmap ?

Thank you

matlabbe commented 1 year ago

What would be the purpose of adding new nodes? Is it to arbitrary add new "places" on area where the robot didn't move over?

For example, adding a node in the middle of a room in a map where the robot didn't move in the middle of the room during mapping. Using the landmark approach, you would need to add a fake constraint between an existing node and a fake landmark id (they should be all negative). Add this constraint in the "Link" table of the database.

If you want to save a place "kitchen" in arbitrary localization in the map (not on the graph), you may create a new table in the database to save the label at a particular location. The "rtabmap.db" can be accessed safely from multiple nodes at the same time (with sqlite3 API), if you use your own custom table to save data, that can be safe to read/write data while rtabmap is doing localization or mapping with it.

Beware that if you add data at a particular global position in the map, as soon the map is re-optimized because of a loop closure, the saved global position will be wrong. It is better to link new data to an existing node in the graph (like the landmark approach above), so that when the graph is optimized, the data will follow it. You can also use subscribe_user_data to add data linked to a node (see http://wiki.ros.org/rtabmap_ros/Tutorials/WifiSignalStrengthMappingUserDataUsage).