diff --git a/docs/rtwcli/index.rst b/docs/rtwcli/index.rst index bac30dd1..64c2faf7 100644 --- a/docs/rtwcli/index.rst +++ b/docs/rtwcli/index.rst @@ -16,7 +16,8 @@ How to install the CLI """""""""""""""""""""""" .. _rtwcli-setup: -Follow the instructions in the ``README.md`` inside the ``rtwcli`` folder `#here `_. +Follow the instructions in the ``README.md`` inside the ``rtwcli`` folder +`#here `_. How to use the CLI @@ -41,20 +42,14 @@ The CLI currently supports the following commands: Setting up a new workspace -""""""""""""""""""""""""""""" +"""""""""""""""""""""""""""" .. _rtwcli-setup-workspace: -PR `#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 `_. 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 `_ +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`` @@ -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 + cd rocker && pip3 install -e . && cd - diff --git a/rtwcli/rtw_cmds/rtw_cmds/workspace/create_verb.py b/rtwcli/rtw_cmds/rtw_cmds/workspace/create_verb.py index e0e8694e..6eb0b1e3 100644 --- a/rtwcli/rtw_cmds/rtw_cmds/workspace/create_verb.py +++ b/rtwcli/rtw_cmds/rtw_cmds/workspace/create_verb.py @@ -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 @@ -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", @@ -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, diff --git a/rtwcli/rtw_cmds/rtw_cmds/workspace/import_verb.py b/rtwcli/rtw_cmds/rtw_cmds/workspace/import_verb.py index 06a87e7a..2e0f52af 100644 --- a/rtwcli/rtw_cmds/rtw_cmds/workspace/import_verb.py +++ b/rtwcli/rtw_cmds/rtw_cmds/workspace/import_verb.py @@ -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 = "" @@ -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, @@ -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, diff --git a/rtwcli/rtwcli/rtwcli/rocker_utils.py b/rtwcli/rtwcli/rtwcli/rocker_utils.py index 50b105fe..a9be189b 100644 --- a/rtwcli/rtwcli/rtwcli/rocker_utils.py +++ b/rtwcli/rtwcli/rtwcli/rocker_utils.py @@ -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, @@ -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"])