Skip to content

Commit

Permalink
Added README.md for dummy_map_server (#572)
Browse files Browse the repository at this point in the history
* ➕ 📖 Added README.md for dummy_map_server ROS2 package. Verified instructions.

Signed-off-by: Bey Hao Yun <[email protected]>

* Update dummy_robot/dummy_map_server/README.md

Decomposed sentence into smaller sizes.

Co-authored-by: Audrow Nash <[email protected]>
Signed-off-by: Bey Hao Yun <[email protected]>

* Update dummy_robot/dummy_map_server/README.md

Reworded.

Co-authored-by: Audrow Nash <[email protected]>
Signed-off-by: Bey Hao Yun <[email protected]>

* 🔨 Modified use of --packages-select to --packages-up-to based on feedback.

Signed-off-by: Bey Hao Yun <[email protected]>

* 🔨 Modified README.md further to adhere to feedback given.

Signed-off-by: Bey Hao Yun <[email protected]>

* 🔨 Modified README.md commands to adhere to higher cross-platform compatibility.

Signed-off-by: Bey Hao Yun <[email protected]>

* Update dummy_robot/dummy_map_server/README.md

Co-authored-by: Audrow Nash <[email protected]>
Signed-off-by: Bey Hao Yun <[email protected]>

Signed-off-by: Bey Hao Yun <[email protected]>
Co-authored-by: Audrow Nash <[email protected]>
  • Loading branch information
cardboardcode and paudrow authored Aug 18, 2022
1 parent aff4e41 commit dcf8814
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions dummy_robot/dummy_map_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
## **What Is This?**

This demo creates and runs a ROS2 **node**, `dummy_map_server`, that publishes `nav_msgs::msg::OccupancyGrid` on a ROS2 publisher topic, `/map`.

**dummy_map_server** is also a dependency of **dummy_robot_bringup**.

Please refer to [dummy_robot_bringup](https://github.com/ros2/demos/tree/rolling/dummy_robot/dummy_robot_bringup).

## **What Is An Occupancy Grid?**

An occupancy grid can be thought of as a map of an environment that has been divided into grid cells, where each grid cell is either occupied or unoccupied (in advanced applications, they can have other states, too).

This map of occupied and unoccupied grid cells can be used to help a robot navigate a space, for example to drive through a room with furniture.

If a robot is navigating a new room, however, there may also be grid cells that are marked as unknown, until that area is explored.

These different states are often stored in the occupancy grid as integers, for example:

:warning: Note that the integer within a cell is application-specific and can go beyond `-1` and `1`.

![](img/occupancy_grid.png)
`-1` represents **unknown** spaces.
`0` represents **unoccupied** spaces.
`1` represents **occupied** spaces.

The illustration above shows an example of an occupancy grid where the **bolded integer** indicates the position of a robot with a lidar sensor mounted on top of it and the red-colored grid cells indicate an obstacle such as a wall.

## **Build**

```bash
colcon build --packages-up-to dummy_map_server
```

## **Run**

```bash
ros2 run dummy_map_server dummy_map_server
```

## **Verify**

A similar terminal output should be seen after running `ros2 run dummy_map_server` and the following commands:

```bash
ros2 topic echo /map
```


```bash
# Terminal Output
header:
stamp:
sec: 1658559453
nanosec: 308405010
frame_id: world
info:
map_load_time:
sec: 0
nanosec: 0
resolution: 0.10000000149011612
width: 100
height: 100
origin:
position:
x: -5.0
y: -5.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
data:
- -1
- -1
- -1
- -1
- -1
- -1
- -1
- -1
- -1
- '...'
---

```

## **References**

- `nav_msgs::msg::OccupancyGrid` Message Format: https://github.com/ros2/common_interfaces/blob/rolling/nav_msgs/msg/OccupancyGrid.msg
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 dcf8814

Please sign in to comment.