Skip to content

Added documentation for multi-robot simulation and teleoperation #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/docs/tutorials/multirobot.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
sidebar_position: 4
title: Multi Robot Simulation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-Robot Simulation

---

This page provides a collection of tutorials that describe how to simulate, launch controllers, and teleoperate multiple BlueROVs. Prior to starting these tutorials, you should have completed the [Running Blue in Simulation](/tutorials/simulation),the [Integrating Custom Controllers](/tutorials/control), and Keyboard teleoperation section in[Teleoperation](/tutorials/teleop) tutorials.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tutorial describes how to simulate and control multiple BlueROVs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to starting this tutorial, you should have completed the Integrating Custom Controllers tutorial and the Keyboard teleoperation tutorial.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a GIF here that shows users what to expect when they run your tutorial? I wrote something similar in the UVMS PR here.


## Multi Robot Simulation and Teleoperation

This tutorial describes how to launch multiple BlueROVs in Gazebo with non-conflicting communication channels, independent controllers, and perform keyboard based teleoperation. It also demonstrates spawning static and dynamic obstacles in the environment.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably merge this with the above paragraph.


<div align="center">
<img src="../../static/img/multi-robot-sim/multi-rob.png" alt="My Image" width="300"/>
</div>
Comment on lines +12 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<img src={MyImage} alt="Multi-robot simulation demo gif" style={{ width: '100%', maxWidth: 700 }} />


### Dependencies

The following ROS 2 dependencies are required for this tutorial:

- Gazebo Harmonic or newer
- [ardusub_driver](https://github.com/Robotic-Decision-Making-Lab/ardusub_driver)
- [auv_controllers](https://github.com/Robotic-Decision-Making-Lab/auv_controllers)
- [teleop_twist_keyboard](https://github.com/ros2/teleop_twist_keyboard)
- [mobile_to_maritime](https://github.com/Robotic-Decision-Making-Lab/mobile_to_maritime)

These dependencies will be met by default if you have installed Blue with
Docker as described in the [installation instructions](/installation).

### Tutorial steps

1. Launch the demo Dependencies for `rob_1` and `rob_3` instances in simulation by running the following commands:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rob_3 and not rob_2?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like:

  1. Launch the dependencies for the first robot rob_1 using,

    ros2 launch blue_demos multi_robot_1.launch.yaml ...

    and in a separate terminal, launch the dependencies for the second robot rob_2 using,

    ros2 launch blue_demos multi_robot_2.launch.yaml ...


```bash
ros2 launch blue_demos rob_1_bluerov2_heavy_demo.launch.yaml use_sim:=true
```

```bash
ros2 launch blue_demos rob_3_bluerov2_heavy_demo.launch.yaml use_sim:=true
```

2. Once Gazebo, ArduSub, and MAVROS have fully loaded, open a new terminal and launch the demo control framework for `rob_1` and `rob_3` instances:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Once Gazebo, ArduSub, and MAVROS have fully loaded, open two new terminals. In the first terminal, launch the control framework for rob_1
ros2 launch blue_demos multi_robot_1_controllers.launch.py use_sim:=true

and in the second terminal, launch the control stack for rob_2:

ros2 launch blue_demos multi_robot_2_controllers.launch.py use_sim:=true


```bash
ros2 launch blue_demos rob_1_bluerov2_heavy_controllers.launch.py use_sim:=true
```

```bash
ros2 launch blue_demos rob_3_bluerov2_heavy_controllers.launch.py use_sim:=true
```

3. For teleoperation, we will launch the `teleop_twist_keyboard` node for each robot instance in a new terminal:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The robots can be teleoperated independently using the teleop_twist_keyboard node. Open two additional terminal instances and run

ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rob_1

in the first and

ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rob_2

in the second.


```bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rob_1
```

```bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/rob_3
```

4. As noted in Teleoperation tutorial, the `teleop_twist_keyboard` node will publish velocity commands according to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, transform the velocity commands into the appropriate frames for the control stack by running

ros2 launch message_transforms message_transforms.launch.py parameters_file:=./blue_demos/multi_robot/teleoperation/config/rob_1_transforms.yaml ns:=/rob_1

in one new terminal, and

ros2 launch message_transforms message_transforms.launch.py parameters_file:=./blue_demos/multi_robot/teleoperation/config/rob_3_transforms.yaml ns:=/rob_3

in a second new terminal.

[REP-105](https://ros.org/reps/rep-0105.html); however, the launched ISMC
adheres to the maritime conventions recorded in [REP-156](https://github.com/ros-infrastructure/rep/pull/398).
To convert the velocity commands to the appropriate convention, run the
`message_transforms` node in a new terminal:

```bash
ros2 launch message_transforms message_transforms.launch.py parameters_file:=<path/to/transforms.yaml>
```

where `<path/to/transforms.yaml>` should be replaced with the path to the
`transforms.yaml` file in the `blue_demos` package, e.g.,

```bash
ros2 launch message_transforms message_transforms.launch.py parameters_file:=./blue_demos/multi_robot/teleoperation/config/rob_1_transforms.yaml ns:=/rob_1
```

```bash
ros2 launch message_transforms message_transforms.launch.py parameters_file:=./blue_demos/multi_robot/teleoperation/config/rob_3_transforms.yaml ns:=/rob_3
```

5. You should now be able to teleoperate both the BlueROV2 using your keyboard from respective terminals.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should now be able to teleoperate either BlueROV2 using its respective keyboard input.

Binary file added docs/static/img/multi-robot-sim/multi-rob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.