Skip to content
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

Multi robot support #207

Merged
merged 14 commits into from
May 10, 2023
Merged
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
56 changes: 50 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
This is a ROS 2 simulation stack for the [iRobot® Create® 3](https://edu.irobot.com/create3) robot.
Both Ignition Gazebo and Classic Gazebo are supported.

> :warning: **To run with Ignition Gazebo you must first build and install the [`gz_ros2_control`](https://github.com/ros-controls/gz_ros2_control) package master branch from sources!**

Have a look at the [Create® 3 documentation](https://iroboteducation.github.io/create3_docs/) for more details on the ROS 2 interfaces exposed by the robot.

## Prerequisites
Expand All @@ -25,13 +23,13 @@ Besides the aforementioned dependencies you will also need at least one among Ig

Install [Gazebo 11](http://gazebosim.org/tutorials?tut=install_ubuntu)

#### Ignition Edifice
#### Ignition Fortress

```bash
sudo apt-get update && sudo apt-get install wget
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update && sudo apt-get install ignition-edifice
sudo apt-get update && sudo apt-get install ignition-fortress
```

## Build
Expand All @@ -55,7 +53,7 @@ rosdep install --from-path src -yi
- Build the workspace with:

```bash
export IGNITION_VERSION=edifice
export IGNITION_VERSION=fortress
colcon build --symlink-install
source install/local_setup.bash
```
Expand All @@ -66,12 +64,35 @@ source install/local_setup.bash

##### Empty world

Create® 3 can be spawned in an empty world in Gazebo and monitored through RViz with
Create® 3 can be spawned in an empty world in Gazebo and monitored through RViz with:

```bash
ros2 launch irobot_create_gazebo_bringup create3_gazebo.launch.py
```

The spawn point can be changed with the `x`, `y`, `z` and `yaw` launch arguments:

```bash
ros2 launch irobot_create_gazebo_bringup create3_gazebo.launch.py x:=1.0 y:=0.5 yaw:=1.5707
```

##### Namespacing

A namespace can be applied to the robot using the `namespace` launch argument:

```bash
ros2 launch irobot_create_gazebo_bringup create3_gazebo.launch.py namespace:=my_robot
```

Multiple robots can be spawned with unique namespaces:

```bash
ros2 launch irobot_create_gazebo_bringup create3_gazebo.launch.py namespace:=robot1
ros2 launch irobot_create_gazebo_bringup create3_spawn.launch.py namespace:=robot2 x:=1.0
```

> :warning: `create3_gazebo.launch.py` should only be used once as it launches the Gazebo simulator itself. Additional robots should be spawned with `create3_spawn.launch.py`. Namespaces and spawn points should be unique for each robot.

##### AWS house

Create® 3 can be spawned in the AWS small house in Gazebo and monitored through RViz.
Expand Down Expand Up @@ -99,6 +120,29 @@ Create® 3 can be spawned in a demo world in Ignition and monitored through RViz
ros2 launch irobot_create_ignition_bringup create3_ignition.launch.py
```

The spawn point can be changed with the `x`, `y`, `z` and `yaw` launch arguments:

```bash
ros2 launch irobot_create_ignition_bringup create3_ignition.launch.py x:=1.0 y:=0.5 yaw:=1.5707
```

##### Namespacing

A namespace can be applied to the robot using the `namespace` launch argument:

```bash
ros2 launch irobot_create_ignition_bringup create3_ignition.launch.py namespace:=my_robot
```

Multiple robots can be spawned with unique namespaces:

```bash
ros2 launch irobot_create_ignition_bringup create3_ignition.launch.py namespace:=robot1
ros2 launch irobot_create_ignition_bringup create3_spawn.launch.py namespace:=robot2 x:=1.0
```

> :warning: `create3_ignition.launch.py` should only be used once as it launches the Ignition simulator itself. Additional robots should be spawned with `create3_spawn.launch.py`. Namespaces and spawn points should be unique for each robot.

## Package layout

This repository contains packages for both the Classic and Ignition Gazebo simulators:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)

install(
DIRECTORY
Expand All @@ -21,6 +22,9 @@ install(
share/${PROJECT_NAME}
)

# Install Python modules
ament_python_install_package(${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
---
hazards_vector_publisher:
ros__parameters:
# Hazard detection publisher topic
publisher_topic: /hazard_detection
publish_rate: 62.0
subscription_topics:
# Bumper topic
- _internal/bumper/event
# Cliff topics
- _internal/cliff_front_left/event
- _internal/cliff_front_right/event
- _internal/cliff_side_left/event
- _internal/cliff_side_right/event
# Wheel drop topics
- _internal/wheel_drop/left_wheel/event
- _internal/wheel_drop/right_wheel/event
# Backup limit topic
- _internal/backup_limit
/**:
hazards_vector_publisher:
ros__parameters:
# Hazard detection publisher topic
publisher_topic: hazard_detection
publish_rate: 62.0
subscription_topics:
# Bumper topic
- _internal/bumper/event
# Cliff topics
- _internal/cliff_front_left/event
- _internal/cliff_front_right/event
- _internal/cliff_side_left/event
- _internal/cliff_side_right/event
# Wheel drop topics
- _internal/wheel_drop/left_wheel/event
- _internal/wheel_drop/right_wheel/event
# Backup limit topic
- _internal/backup_limit
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
ir_intensity_vector_publisher:
ros__parameters:
# IR intensity publisher topic
publisher_topic: /ir_intensity
publish_rate: 62.0
subscription_topics:
# IR intensity topics
- _internal/ir_intensity_front_center_left
- _internal/ir_intensity_front_center_right
- _internal/ir_intensity_front_left
- _internal/ir_intensity_front_right
- _internal/ir_intensity_left
- _internal/ir_intensity_right
- _internal/ir_intensity_side_left
/**:
ir_intensity_vector_publisher:
ros__parameters:
# IR intensity publisher topic
publisher_topic: ir_intensity
publish_rate: 62.0
subscription_topics:
# IR intensity topics
- _internal/ir_intensity_front_center_left
- _internal/ir_intensity_front_center_right
- _internal/ir_intensity_front_left
- _internal/ir_intensity_front_right
- _internal/ir_intensity_left
- _internal/ir_intensity_right
- _internal/ir_intensity_side_left
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
kidnap_estimator_publisher:
ros__parameters:
# Kidnap status publisher topic
kidnap_status_topic: /kidnap_status
# Subscription topics
hazard_topic: /hazard_detection
/**:
kidnap_estimator_publisher:
ros__parameters:
# Kidnap status publisher topic
kidnap_status_topic: kidnap_status
# Subscription topics
hazard_topic: hazard_detection
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
mock_publisher:
ros__parameters:
# Mock slip status publisher topic
slip_status_topic: /slip_status
# Publishers rate
slip_status_publish_rate: 62.0
/**:
mock_publisher:
ros__parameters:
# Mock slip status publisher topic
slip_status_topic: slip_status
# Publishers rate
slip_status_publish_rate: 62.0
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
robot_state:
ros__parameters:
# Stop status publisher topic
stop_status_topic: /stop_status
# Mock battery state publisher topic
battery_state_topic: /battery_state
# Publishers rate
kidnap_status_publish_rate: 1.0
stop_status_publish_rate: 62.0
battery_state_publish_rate: 0.1
# Subscription topics
dock_topic: /dock_status
wheel_vels_topic: /odom
# Stop status position difference tolerance
linear_velocity_tolerance: 0.01
angular_velocity_tolerance: 0.1
# Battery parameters
full_charge_percentage: 1.0
battery_high_percentage: 0.9
# Dock Parameters
undocked_charge_limit: 0.03
/**:
robot_state:
ros__parameters:
# Stop status publisher topic
stop_status_topic: stop_status
# Mock battery state publisher topic
battery_state_topic: battery_state
# Publishers rate
kidnap_status_publish_rate: 1.0
stop_status_publish_rate: 62.0
battery_state_publish_rate: 0.1
# Subscription topics
dock_topic: dock_status
wheel_vels_topic: odom
# Stop status position difference tolerance
linear_velocity_tolerance: 0.01
angular_velocity_tolerance: 0.1
# Battery parameters
full_charge_percentage: 1.0
battery_high_percentage: 0.9
# Dock Parameters
undocked_charge_limit: 0.03
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
ui_mgr:
ros__parameters:
# Buttons publisher topic
button_topic: /interface_buttons
# Publishers rate
buttons_publish_rate: 1.0
# Subscription topics
lightring_topic: /cmd_lightring
audio_topic: /cmd_audio
/**:
ui_mgr:
ros__parameters:
# Buttons publisher topic
button_topic: interface_buttons
# Publishers rate
buttons_publish_rate: 1.0
# Subscription topics
lightring_topic: cmd_lightring
audio_topic: cmd_audio
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
wheel_status_publisher:
ros__parameters:
# Publish rate
publish_rate: 62.0
# Encoder resolution
encoder_resolution: 508.8
# Wheel radius
wheel_radius: 0.03575
# Wheels angular velocity topic
velocity_topic: /wheel_vels
# Wheels' net encoder ticks topic
ticks_topic: /wheel_ticks
/**:
wheel_status_publisher:
ros__parameters:
# Publish rate
publish_rate: 62.0
# Encoder resolution
encoder_resolution: 508.8
# Wheel radius
wheel_radius: 0.03575
# Wheels angular velocity topic
velocity_topic: wheel_vels
# Wheels' net encoder ticks topic
ticks_topic: wheel_ticks
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from typing import Union

from launch import LaunchContext, SomeSubstitutionsType, Substitution


class GetNamespacedName(Substitution):
def __init__(
self,
namespace: Union[SomeSubstitutionsType, str],
name: Union[SomeSubstitutionsType, str]
) -> None:
self.__namespace = namespace
self.__name = name

def perform(
self,
context: LaunchContext = None,
) -> str:
if isinstance(self.__namespace, Substitution):
namespace = str(self.__namespace.perform(context))
else:
namespace = str(self.__namespace)

if isinstance(self.__name, Substitution):
name = str(self.__name.perform(context))
else:
name = str(self.__name)

if namespace == '':
namespaced_name = name
else:
namespaced_name = namespace + '/' + name
return namespaced_name
Loading