Skip to content

Commit 819b198

Browse files
committed
📝 Update docs
* update building and running instructions; * fix some typos. Signed-off-by: Luiz Carlos Cosmi Filho <[email protected]>
1 parent ccd044d commit 819b198

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,36 @@ Exploration is done using just a simple controller `turtlebot3_explorer` based o
2020

2121
### Occupancy grid
2222

23-
The entire solution proposed here for counting obstacles is based on the use of an occupancy grid map. To generate this map, it was developed a ROS2 node that subscribes to receive messages from the laser sensor and updates the occupancy grid map for each message received. Initially, all points on the occupancy map have probability equal to 50%. As messages are received from the laser sensor, occupied points will have probability above 50% and free points on the map will have probability below 50%. This probabilistic occupancy grid is published at a fixed rate in the `/custom_map` topic.
23+
The entire solution proposed here for counting obstacles is based on the use of an occupancy grid map. To generate this map, it was developed a ROS2 node `turtlebot3_occupancy_grid` that subscribes to receive messages from the laser sensor and updates the occupancy grid map for each message received. Initially, all points on the occupancy map have probability equal to 50%. As messages are received from the laser sensor, occupied points will have probability above 50% and free points on the map will have probability below 50%. This probabilistic occupancy grid is published at a fixed rate in the `/custom_map` topic.
2424

2525

2626
<p align="center">
2727
<img src="etc/images/turtlebot3_occupancy_grid.png" alt="turtlebot3_occupancy_grid" width="400"/>
2828
</p>
2929

3030

31-
The occupancy grid mapping algorithm ses the log-odds representation of occupancy:
31+
The occupancy grid mapping algorithm uses the log-odds representation of occupancy:
3232

3333
$$l_{t,i} = log(\frac{p(m_i|z_{1:t},x_{1:t})}{1 - p(m_i|z_{1:t},x_{1:t})})$$
3434

3535
The probabilities are easily recovered from the log-odds ratio:
3636

3737
$$p(m_i|z_{1:t},x_{1:t}) = 1 - \frac{1}{1+ exp(l_{t,i})}$$
3838

39-
The algorithm occupancy grid mapping in below loops through all grid cells $i$, and updates those that were measured. The function `inverse_sensor_model` implements the inverse measurement model $p(m_i|z_{1:t},x_{1:t})$ in its log-odds form: if it measured any smaller than the maximum laser range, then mark the points on the map that are under the laser beam as free and the last one as occupied; if it measured some infinite value, truncated to max laser range and marks all as free grid cells.
39+
The algorithm occupancy grid mapping in below loops through all grid cells $i$, and updates those that were measured. The function `inverse_sensor_model` implements the inverse measurement model $p(m_i|z_{1:t},x_{1:t})$ in its log-odds form: if it measured any smaller than the maximum laser range, then mark the points on the map that are under the laser beam as free and the last one as occupied; if it measured some infinite value, truncated to max laser range and marks all as free grid cells. To accomplish this, an implementation of the [Bresenham line drawing algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) is used.
4040

4141
<p align="center">
4242
<img src="etc/images/occupancy_grid_algo.png" alt="occupancy_grid" width="400"/>
4343
</p>
4444

4545
### Detect obstacles/objects
4646

47+
48+
<p align="center">
49+
<img src="https://scipy-lectures.org/_images/sphx_glr_plot_labels_001.png" alt="connected_components" width="400"/>
50+
</p>
51+
52+
4753
<p align="center">
4854
<img src="etc/images/turtlebot3_object_detector.png" alt="turtlebot3_object_detector" width="400"/>
4955
</p>
@@ -58,24 +64,42 @@ The algorithm occupancy grid mapping in below loops through all grid cells $i$,
5864

5965
## Building
6066

67+
You can build all packages needed to run this assignment with docker:
6168
```bash
62-
docker build -t assignment-1 -f etc/docker/Dockerfile .
69+
docker build -t assignment-1:latest -f etc/docker/Dockerfile .
6370
```
6471

6572
## Runnning
6673

74+
Not really safe, but it works.
6775
```bash
6876
sudo xhost +local:root
6977
```
7078

79+
Then, create a network to run all containers in it:
7180
```bash
7281
docker network create my-net
7382
```
7483

84+
Then, open a terminal in the container with support for the QT application:
85+
```bash
86+
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --device /dev/dri/ --net=my-net assignment-1:latest /bin/bash
87+
```
88+
89+
The first thing you'll need to do is run the gazebo inside the container:
90+
```bash
91+
gazebo
92+
```
93+
94+
We haven't figured out why yet, but the first launch of the gazebo inside the container takes a long time. After the gazebo has opened the first time, you can close it and run our launch.
7595
```bash
76-
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --device /dev/dri/ --net=my-net assignment-1 /bin/bash
96+
ros2 launch turtlebot3_mapper turtlebot3_mapper_launch.py
7797
```
7898

99+
If you want to explore the environment, just open a new container in the same network and run the action client node.
79100
```bash
80-
docker run -it --net=my-net assignment-1 /bin/bash
101+
docker run -it --net=my-net assignment-1:latest /bin/bash
102+
ros2 run turtlebot3_mapper turtlebot3_mission_client -f 200
81103
```
104+
105+
After the task is finished, you can view the results in the generated `results.txt` file.

0 commit comments

Comments
 (0)