Skip to content

Commit

Permalink
Update documentation with nav1 simulation example
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Dec 31, 2024
1 parent 399383e commit 2147218
Showing 1 changed file with 98 additions and 6 deletions.
104 changes: 98 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
- **[Introduction](#introduction)**
- **[Dependency installation, source build and setup](#dependency-installation-source-build-and-setup)**
- **[Simulation examples](#simulation-examples)**
- [Single turtlebot3 world](#single-turtlebot3-world)
- [Multiple turtlebot3 world](#multiple-turtlebot3-world)
- [Nav2 Single turtlebot3 world](#nav2-single-turtlebot3-world)
- [Nav2 Multiple turtlebot3 world](#nav2-multiple-turtlebot3-world)
- [Nav1 Single turtlebot3 world](#nav1-single-turtlebot3-world)
- **[Troubleshooting](#troubleshooting)**
- **[TODOs](#todos)**

Expand Down Expand Up @@ -96,7 +97,7 @@ sudo apt update && sudo apt install ros-jazzy-nav2-bringup
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations ~/turtlebot3_simulations
```

### Single turtlebot3 world
### Nav2 Single turtlebot3 world

![](../media/ff_tb3_faster_smaller.gif)

Expand Down Expand Up @@ -185,7 +186,7 @@ ros2 run rmf_demos_tasks dispatch_patrol \
-st 0
```

### Multiple turtlebot3 world
### Nav2 Multiple turtlebot3 world

> [!NOTE]
> This multi-robot simulation example is only for testing purposes, as it is a different setup than `free_fleet` is intended to be used. The simulation spawns 2 already namespaced robots, while the `free_fleet` architecture expects individual non-namespaced robots to be partnered with a namespaced `zenoh-bridge-ros2dds`.
Expand Down Expand Up @@ -236,7 +237,7 @@ export ROS_DOMAIN_ID=55
ros2 launch free_fleet_examples turtlebot3_world_rmf_common.launch.xml
```

Launch the `free_fleet_adapter` with the current example's configurations, verify that `turtlebot3_1` has been added to fleet `turtletbot`.
Launch the `free_fleet_adapter` with the current example's configurations, verify that `turtlebot3_1` has been added to fleet `turtlebot3`.

```bash
source ~/ff_ws/install/setup.bash
Expand Down Expand Up @@ -273,6 +274,95 @@ ros2 run rmf_demos_tasks dispatch_patrol \
-R robot2
```

### Nav1 Single turtlebot3 world

> [!WARNING]
> The Nav1 integration has only been tested in simulation and in ROS 1 Noetic, and is currently still using a fork of [zenoh-plugin-ros1](https://github.com/aaronchongth/zenoh-plugin-ros1), to support bridge namespacing. This will be updated after contributions to upstream has been made.
Check out the [docker compose integration tests](.github/docker/integration-tests/nav1-docker-compose.yaml) for an overview of how the integration can be set up.

On the machine where the free fleet adapter will run, start a `zenoh` router,

```bash
zenohd

# If using released standalaone binaries
# cd PATH_TO_EXTRACTED_ZENOH_ROUTER
# ./zenohd
```

In the ROS 1 Noetic environment, set up all the prerequisites as mentioned in the [official guide](https://emanual.robotis.com/docs/en/platform/turtlebot3/simulation/#gazebo-simulation), and start the turtlebot3 simulation. See the [relevant docker file](.github/docker/minimal-ros1-sim/Dockerfile) for reference.

```bash
source /opt/ros/noetic/setup.bash
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_world.launch
```

In the ROS 1 Noetic environment, bringup the Nav1 stack with the prepared map in [navigation2](https://github.com/ros-navigation/navigation2/tree/main/nav2_bringup/maps). See the [relevant docker file](.github/docker/minimal-nav1-bringup/Dockerfile) for reference.

```bash
# prepare the map
git clone https://github.com/ros-navigation/navigation2

source /opt/ros/noetic/setup.bash
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=/PATH_TO_navigation2/nav2_bringup/maps/tb3_sandbox.yaml
```

In the ROS 1 Noetic environment, set up prerequisites of [zenoh-plugin-ros1](https://github.com/aaronchongth/zenoh-plugin-ros1), build `zenoh-bridge-ros1` in release, and start it with the [provided config in examples](free_fleet_examples/config/zenoh/turtlebot3_zenoh_bridge_ros1_client_config.json5). See the [relevant docker file](.github/docker/minimal-zenoh-bridge-ros1/Dockerfile) for reference.

```bash
# Get the config file
git clone https://github.com/open-rmf/free_fleet -b easy-full-control

# Build the bridge
git clone --recursive https://github.com/aaronchongth/zenoh-plugin-ros1
cd zenoh-plugin-ros1
cargo build --package zenoh-bridge-ros1 --bin zenoh-bridge-ros1 --release

# Use cargo run, or just run the executable directly
source /opt/ros/noetic/setup.bash
./target/release/zenoh-bridge-ros1 -c PATH_TO_free_fleet/free_fleet_examples/config/zenoh/turtlebot3_zenoh_bridge_ros1_client_config.json5
```

On the machine where the free fleet adapter will run, start the common launch files and the free fleet adapter,

```bash
source ~/ff_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

ros2 launch free_fleet_examples turtlebot3_world_rmf_common.launch.xml
```

Launch the `free_fleet_adapter` with the current example's configurations, verify that `tb3_0` has been added to fleet `turtlebot3`.

```bash
source ~/ff_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

ros2 launch free_fleet_examples nav1_tb3_simulation_fleet_adapter.launch.xml

# Or launch with the rmf-web API server address
# ros2 launch free_fleet_examples nav1_tb3_simulation_fleet_adapter.launch.xml server_uri:="ws://localhost:8000/_internal"
```

Dispatch example RMF patrol tasks using [`rmf-web`](https://github.com/open-rmf/rmf-web) on the same `ROS_DOMAIN_ID` as the RMF core packages, or use the `dispatch_patrol` scripts, which will cause the robot to negotiate as they perform their tasks.

```bash
source ~/ff_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export ROS_DOMAIN_ID=55

# tb3_0 to run clockwise around the map
ros2 run rmf_demos_tasks dispatch_patrol \
-p north_west north_east south_east south_west \
-n 3 \
-st 0 \
-F turtlebot3 \
-R tb3_0
```

## Troubleshooting

* Looking for the legacy implementation of `free_fleet`? Check out the [`legacy`](https://github.com/open-rmf/free_fleet/tree/legacy) branch.
Expand All @@ -283,7 +373,9 @@ ros2 run rmf_demos_tasks dispatch_patrol \

* Simulations don't seem to work properly anymore? Try `ros2 deamon stop`, `ros2 daemon start`, or explicitly kill the `ros` and `gazebo` processes, or restart your machine. It's been noticed that if the ROS 2 or gazebo process are not terminated properly (happens rarely), the network traffic between the simulation robots and the fleet adapter get affected.

* Why is RMF not run with `use_sim_time:=true` in the examples? This is because it is on a different `ROS_DOMAIN_ID` than the simulation, therefore it will not have access to the simulation `clock` topic, the examples running RMF, `free_fleet_adapter` and the tasks will not be using sim time.
* ROS 1 Navigation stack simulation does not seem to work as expected? Check out the [integration tests docker compose](.github/docker/integration-tests/nav1-docker-compose.yaml), as well as the [simulation](.github/docker/minimal-ros1-sim/Dockerfile) and [bringup](.github/docker/minimal-nav1-bringup/Dockerfile) docker files, for any missing dependencies.

* Why does RMF not run with `use_sim_time:=true` in the examples? This is because it is on a different `ROS_DOMAIN_ID` than the simulation, therefore it will not have access to the simulation `clock` topic, the examples running RMF, `free_fleet_adapter` and the tasks will not be using sim time.

* For potential bandwidth issues, especially during multirobot sim example, spinning up a dedicated zenoh router and routing the `zenoh-bridge-ros2dds` manually to it, could help alleviate such issues.

Expand Down

0 comments on commit 2147218

Please sign in to comment.