Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
boxanm committed Jan 28, 2025
1 parent 610afea commit 4e4e981
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 52 deletions.
147 changes: 95 additions & 52 deletions docs/UsingInRos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

If you want to use norlab_icp_mapper in [ROS](http://www.ros.org/) or [ROS 2](https://docs.ros.org/en/jazzy/index.html), you can will need to install few more dependencies:

+ [libpointmatcher_ros](https://github.com/norlab-ulaval/libpointmatcher_ros) allows the conversion of pointclouds from ROS message formats to a libpointmatcher-compatible format.
+ [norlab_icp_mapper_ros](https://github.com/norlab-ulaval/norlab_icp_mapper_ros) is a bridge between the mapper and ROS and provides a mapping node that is already functional and that can be customized using YAML configuration files to suite your needs.
- [libpointmatcher_ros](https://github.com/norlab-ulaval/libpointmatcher_ros) allows the conversion of pointclouds from ROS message formats to a libpointmatcher-compatible format.
- [norlab_icp_mapper_ros](https://github.com/norlab-ulaval/norlab_icp_mapper_ros) is a bridge between the mapper and ROS and provides a mapping node that is already functional and that can be customized using YAML configuration files to suite your needs.

## Tutorial

Expand All @@ -15,72 +15,74 @@ Assuming you completed the [Example: building a map from lidar scans](RunningExa
Download the demonstration data using:

=== "ROS"
TODO
TODO

=== "ROS 2"
```shell
`shell
cd ~/
wget -O demo.zip "http://norlab.s3.valeria.science/demo.zip?AWSAccessKeyId=XMBLP3A0338XN5LASKV2&Expires=2290342833&Signature=NXn1f%2BeJ7NptrzUkNzHtEvdicjc%3D"
unzip demo.zip
rm demo.zip
```
`

### Fetching libpointmatcher_ros

=== "ROS"
```shell
`shell
cd ~/
mkdir -p catkin_ws/src && cd catkin_ws/src/
git clone -b melodic https://github.com/norlab-ulaval/libpointmatcher_ros.git
```
`

=== "ROS 2"
```shell
`shell
cd ~/
mkdir -p ros2_ws/src && cd ros2_ws/src/
git clone https://github.com/norlab-ulaval/libpointmatcher_ros.git
```
`

### Fetching norlab_icp_mapper_ros

=== "ROS"
```shell
`shell
cd ~/catkin_ws/src/
git clone -b melodic https://github.com/norlab-ulaval/norlab_icp_mapper_ros.git
```
`

=== "ROS 2"
```shell
`shell
cd ~/ros2_ws/src/
git clone https://github.com/norlab-ulaval/norlab_icp_mapper_ros.git
```
`

### Fetching mapper_config_template

=== "ROS"
```shell
`shell
cd ~/catkin_ws/src/
git clone -b melodic https://github.com/norlab-ulaval/mapper_config_template.git
```
`

=== "ROS 2"
```shell
`shell
cd ~/ros2_ws/src/
git clone https://github.com/norlab-ulaval/mapper_config_template.git
```
`

### Compiling ros workspace

=== "ROS"
```shell
`shell
cd ~/catkin_ws/
catkin_make
```
`

=== "ROS 2"
```shell
`shell
cd ~/ros2_ws/
colcon build --symlink-install
source ~/ros2_ws/install/setup.bash
```
`

### Mapping basics

Expand All @@ -97,10 +99,10 @@ ensure good localization at all times.

The mapper configuration template `params/config.yaml` contains four important sections :

* ICP parameters used by libpointmatcher to do the registration of new point clouds in the map.
* Input filters which are applied to the new point clouds before being processed.
* Post-processing filters which are applied to the map after adding the new point cloud.
* Mapper parameters that configure the mapper's update condition and MapperModules.
- ICP parameters used by libpointmatcher to do the registration of new point clouds in the map.
- Input filters which are applied to the new point clouds before being processed.
- Post-processing filters which are applied to the map after adding the new point cloud.
- Mapper parameters that configure the mapper's update condition and MapperModules.

See [How to configure the Mapper](MapperConfiguration.md) guide for more details.

Expand All @@ -112,20 +114,20 @@ Finally, the ROS launch file is located in `launch/mapper.launch` for ROS and `l
### Running the demo

=== "ROS"
```shell
`shell
roscore
rosparam set use_sim_time true
roslaunch mapper_config_template mapper.launch
rviz -d ~/demo/config.rviz
rosbag play ~/demo/demo.bag --clock --keep-alive
```
`

=== "ROS 2"
```shell
`shell
ros2 launch mapper_config_template mapper.launch.py
rviz2 -d ~/demo/config.rviz
ros2 bag play ~/demo/demo --clock
```
`

![Final map](images/ros_trajectory.png)

Expand All @@ -134,19 +136,20 @@ Finally, the ROS launch file is located in `launch/mapper.launch` for ROS and `l
#### Lowering the map density

Open the file `mapper.config` and change the following parameter:

```yaml
PointDistanceMapperModule:
minDistNewPoint: 0.1 -> 1.0
PointDistanceMapperModule:
minDistNewPoint: 0.1 -> 1.0
```
#### Changing the map update condition
Open the file `mapper.config` and change the following parameters:

```yaml
updateCondition:
type: overlap -> distance
value: 0.5 -> 1.0
updateCondition:
type: overlap -> distance
value: 0.5 -> 1.0
```

#### Removing points reflected from the robot's chassis
Expand All @@ -170,13 +173,13 @@ Open the file `mapper.config` and add the following lines in the `input` section

```yaml
- BoundingBoxDataPointsFilter:
xMin: -6
xMax: -1.5
yMin: -2.5
yMax: 2.5
zMin: -1
zMax: 1
removeInside: 1
xMin: -6
xMax: -1.5
yMin: -2.5
yMax: 2.5
zMin: -1
zMax: 1
removeInside: 1
```

#### Removing dynamic points
Expand All @@ -194,29 +197,69 @@ Open the file `mapper.config` and add the following lines in the `post` section:
```

Then change the following MapperModule in the `mapperModule` portion of the `mapper` section:

```yaml
DynamicPointsMapperModule:
thresholdDynamic: 0.65
alpha: 0.2
beta: 0.99
beamHalfAngle: 0.01
epsilonA: 0.01
epsilonD: 0.01
DynamicPointsMapperModule:
thresholdDynamic: 0.65
alpha: 0.2
beta: 0.99
beamHalfAngle: 0.01
epsilonA: 0.01
epsilonD: 0.01
```

#### Deskewing the input point cloud

Unlike the other mapping modueles, deskewing is part of the ROS 2 wrapper `norlab_icp_mapper_ros'.
This is due to the fact that deskewing requires TF2 interpolations which must happen inside the ROS ecosystem.
To enable deskewing, set the `deskew`parameter to`true`in the`mapper.launch.py` file.
Moreover, you can adjust the deskewing behavior by changing these two parameters:

- `expected_unique_deskewing_TF_number`: defines the number of unique TFs that are expected to be used for deskewing. This number is used to prealocated memory space in a hash map and while an incorrect value might cause slowdowns, it is not that important.
- `deskewing_round_to_nanosecs`: defines the time resolution at which the deskewing TFs are rounded. This is used to reduce the number of TFs that are queried from the TF buffer. A value of 50000 means that the TFs are rounded to the nearest 50 microseconds.

`````yaml
````python
deskew = True
```yaml
- SurfaceNormalDataPointsFilter:
knn: 10

- CutAtDescriptorThresholdDataPointsFilter:
descName: probabilityDynamic
useLargerThan: 1
threshold: 0.65
`````
Then change the following MapperModule in the `mapperModule` portion of the `mapper` section:

```yaml
DynamicPointsMapperModule:
thresholdDynamic: 0.65
alpha: 0.2
beta: 0.99
beamHalfAngle: 0.01
epsilonA: 0.01
epsilonD: 0.01
```

#### Saving the map

You can save the map by calling the `/save_map` service. Similarly, use the `/save_trajectory` service to save the trajectory.
=== "ROS"
```shell
`shell
rosservice call /save_map "map_file_name:
data: '$HOME/demo/demo.vtk'"
```
`

=== "ROS 2"
```shell
`shell
ros2 service call /save_map norlab_icp_mapper_ros/srv/SaveMap "{map_file_name: {data: '$HOME/demo/demo.vtk'}}"
```
`

### Final Result

You can visualize the final result in [ParaView](https://www.paraview.org/) or other point cloud viewer of your choice.
![Final map](images/ros_map.png)
Binary file modified docs/images/diagram_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/diagram_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4e4e981

Please sign in to comment.