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

Add Flag to Enable IPC #234

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
27 changes: 27 additions & 0 deletions docs/rtwcli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,30 @@ The workspace can additionally be created using ``.repos`` files in your reposit

This is done due to the fact that the setting up of the rocker container
fails often.

How to setup ROS2 RTW for inter communication
""""""""""""""""""""""""""""""""""""""""""""""
.. _rtwcli-ipc-usage:

The CLI provides a way to setup ROS2 RTW for inter communication between RTW workspaces.

.. important::
make sure to use the updated ``rocker`` from `PR #285 <https://github.com/osrf/rocker/pull/285>`_. Until this PR is merged you are encouraged to setup the rocker with:
sachinkum0009 marked this conversation as resolved.
Show resolved Hide resolved

* Example:

.. code-block:: bash

rtw workspace create \
--ws-folder humble_ws \
--ros-distro humble \
--docker --enable-ipc
sachinkum0009 marked this conversation as resolved.
Show resolved Hide resolved

rtw workspace create \
--ws-folder rolling_ws \
--ros-distro rolling \
--docker --enable-ipc
sachinkum0009 marked this conversation as resolved.
Show resolved Hide resolved

(humble_ws)$ ros2 run demo_nodes_cpp talker

(rolling_ws)$ ros2 run demo_nodes_cpp listener
8 changes: 8 additions & 0 deletions rtwcli/rtw_cmds/rtw_cmds/workspace/create_verb.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class CreateVerbArgs:
repos_no_skip_existing: bool = False
disable_nvidia: bool = False
docker: bool = False
enable_ipc: bool = False

@property
def ws_name(self) -> str:
Expand Down Expand Up @@ -385,6 +386,12 @@ def add_arguments(self, parser: argparse.ArgumentParser, cli_name: str):
help="Disable nvidia rocker flag",
default=False,
)
parser.add_argument(
"--enable-ipc",
action="store_true",
help="Enable IPC for the docker workspace.",
default=False,
)
parser.add_argument(
"--ws-repos-file-name",
type=str,
Expand Down Expand Up @@ -916,6 +923,7 @@ def main(self, *, args):
disable_nvidia=create_args.disable_nvidia,
container_name=create_args.container_name,
hostname=create_args.hostname,
enable_ipc=create_args.enable_ipc,
ssh_abs_path=create_args.ssh_abs_path,
ssh_abs_path_in_docker=create_args.ssh_abs_path_in_docker,
final_image_name=create_args.final_image_name,
Expand Down
8 changes: 8 additions & 0 deletions rtwcli/rtw_cmds/rtw_cmds/workspace/import_verb.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ImportVerbArgs:
standalone_docker_image: str
docker: bool = True
disable_nvidia: bool = False
enable_ipc: bool = False
standalone: bool = True
final_image_name: str = ""
container_name: str = ""
Expand Down Expand Up @@ -88,6 +89,12 @@ def add_arguments(self, parser: argparse.ArgumentParser, cli_name: str):
help="Disable nvidia rocker flag",
default=False,
)
parser.add_argument(
"--enable-ipc",
action="store_true",
help="Enable IPC for the docker workspace.",
default=False,
)
parser.add_argument(
"--final-image-name",
type=str,
Expand Down Expand Up @@ -136,6 +143,7 @@ def main(self, *, args):
disable_nvidia=import_args.disable_nvidia,
container_name=import_args.container_name,
hostname=import_args.hostname,
enable_ipc=import_args.enable_ipc,
ssh_abs_path=import_args.ssh_abs_path,
ssh_abs_path_in_docker=import_args.ssh_abs_path_in_docker,
final_image_name=import_args.final_image_name,
Expand Down
4 changes: 4 additions & 0 deletions rtwcli/rtwcli/rtwcli/rocker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def generate_rocker_flags(
disable_nvidia: bool,
container_name: str,
hostname: str,
enable_ipc: bool,
ssh_abs_path: str,
ssh_abs_path_in_docker: str,
final_image_name: str,
Expand Down Expand Up @@ -54,6 +55,9 @@ def generate_rocker_flags(
rocker_flags.extend(["--name", container_name])
rocker_flags.extend(["--network", "host"])

if enable_ipc:
rocker_flags.extend(["--ipc", "host"])

if not disable_nvidia:
rocker_flags.extend(["--nvidia", "gpus"])

Expand Down
Loading