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 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
62 changes: 49 additions & 13 deletions docs/rtwcli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ How to install the CLI
""""""""""""""""""""""""
.. _rtwcli-setup:

Follow the instructions in the ``README.md`` inside the ``rtwcli`` folder `#here <https://github.com/StoglRobotics/ros_team_workspace/blob/master/rtwcli/README.md>`_.
Follow the instructions in the ``README.md`` inside the ``rtwcli`` folder
`#here <https://github.com/StoglRobotics/ros_team_workspace/blob/master/rtwcli/README.md>`_.


How to use the CLI
Expand All @@ -41,20 +42,14 @@ The CLI currently supports the following commands:


Setting up a new workspace
"""""""""""""""""""""""""""""
""""""""""""""""""""""""""""
.. _rtwcli-setup-workspace:

PR `#169 <https://github.com/StoglRobotics/ros_team_workspace/pull/169>`_ introduced a new feature to create a new local or dockerized workspace.
The workspace can additionally be created using ``.repos`` files in your repository, streamlining the setup process for complex projects with multiple repositories.

.. important::
**From May 2024** If you want to setup a dockerized workspace with nvidia support based on Ubuntu 24.04 (for Jazzy and Rolling) - make sure to use the updated ``rocker`` from `PR #279 <https://github.com/osrf/rocker/pull/279>`_. Until this PR is merged you are encoruged to setup the rocker with:

.. code-block:: bash

pip3 uninstall rocker # is you have installed it with `sudo` use it here too
git clone https://github.com/StoglRobotics-forks/rocker.git --branch try_24
cd rocker && pip3 install -e . && cd -
PR `#169 <https://github.com/StoglRobotics/ros_team_workspace/pull/169>`_
introduced a new feature to create a new local or dockerized workspace.
The workspace can additionally be created using ``.repos`` files in your
repository, streamlining the setup process for complex projects with multiple
repositories.

* Usage:
* ``rtw workspace create``
Expand Down Expand Up @@ -142,3 +137,44 @@ 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.

* Example:

.. code-block:: bash

rtw workspace create \
--ws-folder humble_ws \
--ros-distro humble \
--docker \
--enable-ipc

rtw workspace create \
--ws-folder rolling_ws \
--ros-distro rolling \
--docker \
--enable-ipc

(humble_ws)$ ros2 run demo_nodes_cpp talker

(rolling_ws)$ ros2 run demo_nodes_cpp listener


How to install rocker fork with the new features
""""""""""""""""""""""""""""""""""""""""""""""""""
.. _rtwcli-setup-rocker-fork:

Until rocker PR is merged you are encouraged to install your rocker fork with:

.. code-block:: bash

pip3 uninstall rocker # if you have installed it with 'sudo' use it here too
git clone https://github.com/StoglRobotics-forks/rocker.git --branch <your-feature-branch>
cd rocker && pip3 install -e . && cd -
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
disable_upgrade: bool = False

@property
Expand Down Expand Up @@ -386,6 +387,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(
"--disable-upgrade",
action="store_true",
Expand Down Expand Up @@ -923,6 +930,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