Skip to content

Commit

Permalink
Implement name specific map_saving
Browse files Browse the repository at this point in the history
  • Loading branch information
lennarthaller committed Jul 25, 2019
1 parent 9d1973f commit 8728603
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ There are three types of parameters right now: static- and dynamic ros parameter
The static parameters are send to the ROS parameter server at startup and are not supposed to change. They are set in the launch files which are located at ros/launch. The parameters are:

- **load_map**: Bool. If set to true, the node will try to load the map provided with map_file at startup.
- **map_file**: String. The name of the file the map is saved at.
- **map_file**: String. The name of the file the map is loaded from.
- **settings_file**: String. The location of config file mentioned above.
- **voc_file**: String. The location of config vocanulary file mentioned above.
- **publish_pointcloud**: Bool. If the pointcloud containing all key points (the map) should be published.
Expand Down Expand Up @@ -136,6 +136,10 @@ So the save_map services are:
- **/orb_slam2_mono/save_map**
- **/orb_slam2_stereo/save_map**

The save_map service expects the name of the file the map should be saved at as input.

At the moment, while the save to file takes place, the SLAM is inactive.

# 5. Run
After sourcing your setup bash using
```
Expand All @@ -155,10 +159,11 @@ Here are some answers to frequently asked questions.
### How to save the map
To save the map with a simple command line command run one the commands (matching to your node running):
```
rosservice call /orb_slam2_rgbd/save_map
rosservice call /orb_slam2_stereo/save_map
rosservice call /orb_slam2_mono/save_map
rosservice call /orb_slam2_rgbd/save_map map.bin
rosservice call /orb_slam2_stereo/save_map map.bin
rosservice call /orb_slam2_mono/save_map map.bin
```
You can replace "map.bin" with any file name you want.
The file will be saved at ROS_HOME which is by default ~/.ros

### Using a new / different camera
Expand Down
2 changes: 1 addition & 1 deletion ros/launch/orb_slam2_d435_rgbd.launch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<param name="reset_map" type="bool" value="false" />

<!-- static parameters -->
<param name="load_map" type="bool" value="true" />
<param name="load_map" type="bool" value="false" />
<param name="map_file" type="string" value="map.bin" />
<param name="settings_file" type="string" value="$(find orb_slam2_ros)/orb_slam2/config/RealSenseD435RGBD.yaml" />
<param name="voc_file" type="string" value="$(find orb_slam2_ros)/orb_slam2/Vocabulary/ORBvoc.txt" />
Expand Down
6 changes: 4 additions & 2 deletions ros/src/Node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ void Node::ParamsChangedCallback(orb_slam2_ros::dynamic_reconfigureConfig &confi


bool Node::SaveMapSrv (orb_slam2_ros::SaveMap::Request &req, orb_slam2_ros::SaveMap::Response &res) {
res.success = orb_slam_->SaveMap(map_file_name_param_);
res.success = orb_slam_->SaveMap(req.name);

if (res.success) {
ROS_INFO ("Map was saved.");
ROS_INFO_STREAM ("Map was saved as " << req.name);
} else {
ROS_ERROR ("Map could not be saved.");
}

return res.success;
Expand Down
1 change: 1 addition & 0 deletions srv/SaveMap.srv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
string name
---
bool success

0 comments on commit 8728603

Please sign in to comment.