Skip to content

feat: updated docker setup for manipulation demo #641

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 24 commits into
base: main
Choose a base branch
from

Conversation

Cytrus14
Copy link
Contributor

@Cytrus14 Cytrus14 commented Jun 24, 2025

Purpose

This PR introduces updates to the Docker setup and implements changes necessary to run the manipulation demo within a containerized environment.

Proposed Changes

  • Updates to selected RAI components to ensure proper operation inside of a container.
  • Updates to the Dockerfile.
  • Updates to the documentation, specifically docs/demos/manipulation.md and docs/setup/setup_docker.md.

Issues

Testing

  1. Modify the docker file to use the branch from this PR instead of the main branch. Specifically, add these lines to the dockerfile after the RUN git clone https://github.com/RobotecAI/rai.git . command:
RUN git pull
RUN git switch dm/feat/docker-image-manipulator-demo
  1. Setup the manipulation arm demo as described in the [updated documentation](https://github.com/RobotecAI/rai/blob/dm/feat/docker-image-manipulator-demo/docs/demos/manipulation.md
  2. Run the demo

Summary by CodeRabbit

  • New Features

    • Added a configurable Docker build process with a new argument to select dependency groups and improved environment setup for ROS 2 and Fast DDS.
    • Introduced a Fast DDS XML configuration file for custom transport settings.
    • Enhanced vision agent logic to better manage weight file paths and prevent redundant assignments.
  • Bug Fixes

    • Added explicit device selection for model initialization in vision markup, ensuring correct use of CUDA or CPU.
    • Implemented a timeout for long-running vision service calls to prevent indefinite waiting.
  • Documentation

    • Expanded and reorganized Docker setup guides, including detailed instructions for manipulation demos and ROS 2 communication between host and container.
    • Clarified build and run steps for different ROS 2 versions and dependency groups.
  • Chores

    • Added a comprehensive .dockerignore file to optimize Docker image builds by excluding unnecessary files and directories.

@Cytrus14 Cytrus14 requested a review from maciejmajek June 24, 2025 07:06
2. Install the eProsima Fast DDS middleware (should come preinstalled with ROS 2):

```shell
apt install ros-"${ROS_DISTRO}"-fastrtps
Copy link
Member

Choose a reason for hiding this comment

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

ROS_DISTRO env variable is only available when ros2 is installed

Suggested change
apt install ros-"${ROS_DISTRO}"-fastrtps
source /opt/ros/jazzy/setup.bash # or humble
sudo apt install ros-"${ROS_DISTRO}"-fastrtps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added step to docs with sourcing ROS 2 in aca7613

Copy link
Member

Choose a reason for hiding this comment

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

please add sudo for apt as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added sudo in 5f3d0c2

```

## 3. Run the tests to confirm the setup
## 4. Run the tests to confirm the setup
Copy link
Member

Choose a reason for hiding this comment

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

When I run tests in the image without DEPENDENCIES=all_groups tests fail

Copy link
Member

Choose a reason for hiding this comment

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

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================================================================= 5 warnings, 4 errors in 2.61s =========================================================================================================================
(rai-framework-py3.10) root@robo-pc-005:/rai# =============================================================================================================================== warnings summary ================================================================================================================================
../root/.cache/pypoetry/virtualenvs/rai-framework-LG7o02pr-py3.10/lib/python3.10/site-packages/pydub/utils.py:300
../root/.cache/pypoetry/virtualenvs/rai-framework-LG7o02pr-py3.10/lib/python3.10/site-packages/pydub/utils.py:301
../root/.cache/pypoetry/virtualenvs/rai-framework-LG7o02pr-py3.10/lib/python3.10/site-packages/pydub/utils.py:310
../root/.cache/pypoetry/virtualenvs/rai-framework-LG7o02pr-py3.10/lib/python3.10/site-packages/pydub/utils.py:314
  Warning: invalid escape sequence '\('

../root/.cache/pypoetry/virtualenvs/rai-framework-LG7o02pr-py3.10/lib/python3.10/site-packages/pydub/utils.py:170
  Warning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================ short test summary info ============================================================================================================================ 
ERROR tests/communication/sounds_device - ModuleNotFoundError: No module named 'sounddevice'
ERROR tests/rai_bench/manipulation_o3de/tasks - ModuleNotFoundError: No module named 'hydra'
ERROR tests/rai_bench/tool_calling_agent - ModuleNotFoundError: No module named 'hydra'
ERROR tests/smoke - ImportError: This feature is based on sounddevice. Make sure sounddevice is installed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
========================================================================================================================= 5 warnings, 4 errors in 2.61s =========================================================================================================================

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update the command for running tests in 5bfdd91

Copy link
Member

@boczekbartek boczekbartek Jun 26, 2025

Choose a reason for hiding this comment

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

@Cytrus14
how about:

poetry run pytest tests/{agents,messages,tools,types}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the proposed command is more comprehensive. Changed in 17a3719

2. On the host machine, download the latest binary release for the Robotic Arm Demo:

```shell
./scripts/download_demo.sh manipulation
Copy link
Member

Choose a reason for hiding this comment

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

downloaded binary is specific to ros2 version. Is it possible to run this example in such setup:
host: ros2 jazzy
docker: ros2 humble?

I think communication-wise it might not work, so I would resolve it by mentioningin the docs that we advise against such setup with 2 different ros2 versions. Then download script will work fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 6ff5bd1

Copy link
Member

Choose a reason for hiding this comment

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

I think the warning should also be added to docker docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in ad28165

@Cytrus14 Cytrus14 requested a review from boczekbartek June 26, 2025 10:34
@boczekbartek
Copy link
Member

@Cytrus14
Thank you for responding to my comments! Could you take a look at this one: https://github.com/RobotecAI/rai/pull/641/files#r2168690801?

4. Configure the DDS middleware using the `fastrtps_config.xml` file included in the RAI repository:

```shell
export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastrtps_config.xml
Copy link
Member

Choose a reason for hiding this comment

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

please give the path explicitely:

export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/docker/fastrtps_config.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 64cc205

@boczekbartek
Copy link
Member

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

Walkthrough

A new .dockerignore file was added to optimize Docker build contexts. The Dockerfile was updated to support dependency group selection, environment variables, and improved installation steps. Fast DDS configuration was introduced via XML. Documentation was expanded for Docker and manipulation demo setup. Minor logic improvements were made to vision agent and segmentation tools.

Changes

File(s) Change Summary
.dockerignore Added a comprehensive ignore file to exclude unnecessary files and directories from Docker build context, including Python artifacts, IDE configs, ROS/Celery/Jupyter outputs, and project-specific files.
docker/Dockerfile Added build arg DEPENDENCIES (default: core_only), validation for allowed values, simplified apt install, added zip package, updated Poetry to 2.1.3, copied context instead of cloning, set Fast DDS/RMW env vars, and made Poetry install conditional on dependency group.
docker/fastrtps_config.xml Introduced Fast DDS XML config defining a custom UDP transport and default participant profile for ROS 2 communication.
docs/demos/manipulation.md Expanded with a new Docker Setup section, providing step-by-step instructions for running the manipulation demo in Docker, including prerequisites, build, run, and execution steps. Reorganized local setup instructions.
docs/setup/setup_docker.md Expanded and reorganized Docker setup documentation: clarified image build options, added repository cloning step, detailed host-container ROS 2 communication setup, updated Docker run commands, and refined test instructions.
src/rai_extensions/rai_open_set_vision/rai_open_set_vision/agents/base_vision_agent.py Added _is_weights_path_set boolean instance variable; modified weight path initialization logic to prevent repeated reassignment of _weights_path and ensure correct path handling during weight downloads.
src/rai_extensions/rai_open_set_vision/rai_open_set_vision/tools/segmentation_tools.py Added a 60-second timeout to get_future_result calls in GetGrabbingPointTool._run for GroundingDino and Grounded SAM service responses; added explanatory comment.
src/rai_extensions/rai_open_set_vision/rai_open_set_vision/vision_markup/boxer.py Imported torch and modified GDBoxer constructor to explicitly set model device to "cuda" if available, otherwise "cpu", when use_cuda is true.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docker
    participant Poetry
    participant ROS2
    participant FastDDS

    User->>Docker: Build image (with DEPENDENCIES arg)
    Docker->>Docker: Validate DEPENDENCIES (core_only/all_groups)
    Docker->>Docker: Install system packages (incl. zip)
    Docker->>Docker: Install Poetry 2.1.3
    Docker->>Docker: Copy project context
    Docker->>Docker: Set FastDDS and RMW env vars
    Docker->>Poetry: Install dependencies (core_only or all_groups)
    Docker->>ROS2: Install ROS dependencies, build workspace
    Docker->>FastDDS: Use fastrtps_config.xml for communication
Loading
sequenceDiagram
    participant User
    participant Host
    participant DockerContainer
    participant ROS2
    participant FastDDS

    User->>Host: Clone repo, build Docker image
    User->>Host: Source ROS2, set ROS_DOMAIN_ID
    User->>Host: Configure FastDDS (fastrtps_config.xml)
    User->>DockerContainer: Run container with env vars and network settings
    DockerContainer->>ROS2: Use FastDDS for communication
    DockerContainer->>Host: Communicate via shared DDS domain
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
docker/Dockerfile (2)

21-24: Shell-level check works, but quoting is unnecessary noisy
Docker performs $ARG/$ENV interpolation before the line is executed, so the internal bash sees literal values.
You can simplify/clarify the check and avoid the double quoting:

-RUN /bin/bash -c 'if [ "${DEPENDENCIES}" != "core_only" ] && [ "${DEPENDENCIES}" != "all_groups" ]; then \
+RUN /bin/bash -c 'if [ "$DEPENDENCIES" != core_only ] && [ "$DEPENDENCIES" != all_groups ]; then \

47-51: Duplicate if block – consider DRYing with Poetry’s --with flag
Rather than branching, you can pass --without dev,tests,… when core_only is requested.
Not blocking, but makes the layer cache friendlier.

docs/setup/setup_docker.md (2)

70-78: Provide an explicit, copy-pastable path for FASTRTPS_DEFAULT_PROFILES_FILE
Users unfamiliar with the repo layout may struggle to locate the file.

-    export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastrtps_config.xml
+    export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/docker/fastrtps_config.xml

58-67: Small typo: mismatch between fenced code block and list indentation
Markdown renderers show the code block as plain text.
Indent the fenced block by four spaces (or switch to indented style) to satisfy MD046 and keep consistency.

docs/demos/manipulation.md (1)

110-115: Grammar: drop redundant “of”

-        docker run --net=host --ipc=host --pid=host -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID --gpus all -it rai:jazzy # or rai:humble
+        docker run --net=host --ipc=host --pid=host -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID --gpus all -it rai:jazzy # or rai:humble

(The phrase “inside of the docker container” appears a few lines below; change to “inside the docker container” for clarity.)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d54fffc and 7bfadf1.

📒 Files selected for processing (8)
  • .dockerignore (1 hunks)
  • docker/Dockerfile (1 hunks)
  • docker/fastrtps_config.xml (1 hunks)
  • docs/demos/manipulation.md (3 hunks)
  • docs/setup/setup_docker.md (1 hunks)
  • src/rai_extensions/rai_open_set_vision/rai_open_set_vision/agents/base_vision_agent.py (2 hunks)
  • src/rai_extensions/rai_open_set_vision/rai_open_set_vision/tools/segmentation_tools.py (1 hunks)
  • src/rai_extensions/rai_open_set_vision/rai_open_set_vision/vision_markup/boxer.py (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
docs/demos/manipulation.md (8)
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:40-44
Timestamp: 2024-11-28T14:37:22.619Z
Learning: In the `rosbot-xl.launch.py` and `turtlebot.launch.py` launch files, the `run-nav.bash` scripts are different for each demo and should remain as separate calls to maintain clarity in the demo launches.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:34-38
Timestamp: 2024-11-28T14:35:45.411Z
Learning: The demo scripts and launch files in the `examples` directory are not yet implemented as ROS 2 packages, so `FindPackageShare` cannot be used to locate them.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:57-69
Timestamp: 2024-11-28T15:46:06.103Z
Learning: In this project, prefer to keep ROS2 launch files simple and easy to use, and avoid adding non-standard features like executable verification and error handling unless necessary.
Learnt from: maciejmajek
PR: RobotecAI/rai#379
File: tests/communication/ros2/test_connectors.py:57-62
Timestamp: 2025-01-21T12:43:24.467Z
Learning: The ROS2 node discovery mechanism in tests is planned to be implemented in the future. Current tests use xfail to document this limitation.
Learnt from: maciejmajek
PR: RobotecAI/rai#383
File: tests/tools/ros2/test_topic_tools.py:84-105
Timestamp: 2025-01-24T13:42:58.814Z
Learning: The ROS2 node discovery in the test suite is asynchronous, and the current implementation doesn't wait for topic discovery. This is a known limitation that causes tests like `test_receive_message_tool` and `test_receive_image_tool` to be marked as `xfail`. A proper discovery mechanism with timeout will be implemented in the future to ensure reliable topic communication.
Learnt from: maciejmajek
PR: RobotecAI/rai#508
File: src/rai_core/rai/tools/ros2/nav2.py:34-38
Timestamp: 2025-04-07T16:16:36.242Z
Learning: The tools in src/rai_core/rai/tools/ros2/nav2.py are intentionally simplified versions of the more generic ROS2 tools, with a simplified implementation approach that uses global variables.
Learnt from: boczekbartek
PR: RobotecAI/rai#314
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:0-0
Timestamp: 2024-12-02T13:51:47.310Z
Learning: In `sim_whoami_demo.launch.py`, the `robot_description_package` launch argument is already declared in the imported `rai_whoami_node` launch file `rai_whoami_node`, so it doesn't need to be redeclared in `sim_whoami_demo.launch.py`.
Learnt from: maciejmajek
PR: RobotecAI/rai#386
File: src/rai/rai/tools/ros/tools.py:30-30
Timestamp: 2025-01-25T14:33:56.413Z
Learning: In the RAI package, ROS2-related Python packages (e.g., tf_transformations) are currently installed via rosdep rather than being declared in pyproject.toml.
docker/Dockerfile (3)
Learnt from: maciejmajek
PR: RobotecAI/rai#386
File: src/rai/rai/tools/ros/tools.py:30-30
Timestamp: 2025-01-25T14:33:56.413Z
Learning: In the RAI package, ROS2-related Python packages (e.g., tf_transformations) are currently installed via rosdep rather than being declared in pyproject.toml.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:57-69
Timestamp: 2024-11-28T15:46:06.103Z
Learning: In this project, prefer to keep ROS2 launch files simple and easy to use, and avoid adding non-standard features like executable verification and error handling unless necessary.
Learnt from: maciejmajek
PR: RobotecAI/rai#508
File: src/rai_core/rai/tools/ros2/nav2.py:34-38
Timestamp: 2025-04-07T16:16:36.242Z
Learning: The tools in src/rai_core/rai/tools/ros2/nav2.py are intentionally simplified versions of the more generic ROS2 tools, with a simplified implementation approach that uses global variables.
docs/setup/setup_docker.md (9)
Learnt from: maciejmajek
PR: RobotecAI/rai#386
File: src/rai/rai/tools/ros/tools.py:30-30
Timestamp: 2025-01-25T14:33:56.413Z
Learning: In the RAI package, ROS2-related Python packages (e.g., tf_transformations) are currently installed via rosdep rather than being declared in pyproject.toml.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:57-69
Timestamp: 2024-11-28T15:46:06.103Z
Learning: In this project, prefer to keep ROS2 launch files simple and easy to use, and avoid adding non-standard features like executable verification and error handling unless necessary.
Learnt from: maciejmajek
PR: RobotecAI/rai#379
File: tests/communication/ros2/test_connectors.py:57-62
Timestamp: 2025-01-21T12:43:24.467Z
Learning: The ROS2 node discovery mechanism in tests is planned to be implemented in the future. Current tests use xfail to document this limitation.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:34-38
Timestamp: 2024-11-28T14:35:45.411Z
Learning: The demo scripts and launch files in the `examples` directory are not yet implemented as ROS 2 packages, so `FindPackageShare` cannot be used to locate them.
Learnt from: maciejmajek
PR: RobotecAI/rai#508
File: src/rai_core/rai/tools/ros2/nav2.py:34-38
Timestamp: 2025-04-07T16:16:36.242Z
Learning: The tools in src/rai_core/rai/tools/ros2/nav2.py are intentionally simplified versions of the more generic ROS2 tools, with a simplified implementation approach that uses global variables.
Learnt from: rachwalk
PR: RobotecAI/rai#393
File: tests/communication/sounds_device/test_connector.py:68-77
Timestamp: 2025-01-30T16:48:57.540Z
Learning: When testing audio processing in Python, using mock audio data (e.g., b"mock_audio_data") is preferred over loading real audio files to ensure test reliability, speed, and isolation, unless there's a specific need to test file format compatibility or audio properties.
Learnt from: maciejmajek
PR: RobotecAI/rai#416
File: src/rai_core/rai/communication/ros2/connectors.py:241-267
Timestamp: 2025-02-10T21:35:25.819Z
Learning: Avoid circular imports in the ROS2 connector modules by placing utility functions in dedicated utility modules that don't import from the connector modules.
Learnt from: maciejmajek
PR: RobotecAI/rai#367
File: src/rai/rai/communication/ros2/api.py:370-373
Timestamp: 2025-01-16T16:40:58.528Z
Learning: The ROS2 high-level API in `src/rai/rai/communication/ros2/api.py` is intentionally designed to be synchronous for simpler usage, without requiring callback handling.
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:40-44
Timestamp: 2024-11-28T14:37:22.619Z
Learning: In the `rosbot-xl.launch.py` and `turtlebot.launch.py` launch files, the `run-nav.bash` scripts are different for each demo and should remain as separate calls to maintain clarity in the demo launches.
🧬 Code Graph Analysis (1)
src/rai_extensions/rai_open_set_vision/rai_open_set_vision/tools/segmentation_tools.py (1)
src/rai_core/rai/communication/ros2/ros_async.py (1)
  • get_future_result (21-37)
🪛 LanguageTool
docs/demos/manipulation.md

[uncategorized] ~132-~132: Possible missing comma found.
Context: ...``` #### 2. Running the demo !!! note Source the setup shell Ensure ROS 2 is so...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~142-~142: This phrase is redundant. Consider using “inside”.
Context: ...ell) Launch the Robotic Arm Demo script inside of the docker container: ```shell ...

(OUTSIDE_OF)

docs/setup/setup_docker.md

[style] ~46-~46: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 1187 characters long)
Context: ...ons between docker and host (Optional) !!! tip "ROS 2 communication" If you i...

(EN_EXCESSIVE_EXCLAMATION)

🪛 markdownlint-cli2 (0.17.2)
docs/demos/manipulation.md

99-99: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


105-105: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


119-119: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


126-126: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


138-138: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


144-144: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


150-150: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


156-156: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

docs/setup/setup_docker.md

12-12: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


21-21: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


27-27: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


35-35: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


41-41: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


58-58: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


64-64: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


70-70: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


76-76: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


82-82: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


90-90: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


96-96: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)


102-102: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

🔇 Additional comments (8)
.dockerignore (1)

1-182: LGTM! Comprehensive .dockerignore with good project-specific exclusions.

The .dockerignore file is well-structured and includes appropriate exclusions for Python, ROS, and project-specific files. The explicit include pattern !examples/imgs/*.md correctly preserves markdown files in the examples/imgs directory while excluding other content.

docker/fastrtps_config.xml (1)

1-17: LGTM! Valid Fast DDS configuration for containerized environments.

The XML configuration correctly defines a custom UDPv4 transport and sets up the participant profile as default. Disabling built-in transports and using a custom transport is a common pattern for ensuring consistent DDS behavior in Docker containers.

src/rai_extensions/rai_open_set_vision/rai_open_set_vision/vision_markup/boxer.py (2)

20-20: LGTM! Adding torch import for CUDA availability check.

The torch import is necessary for the torch.cuda.is_available() check introduced in the constructor.


75-76: Excellent improvement for robust device selection.

The explicit CUDA availability check prevents runtime errors when CUDA is requested but not available. This is much safer than the previous implicit device selection and provides better fallback behavior in containerized environments.

src/rai_extensions/rai_open_set_vision/rai_open_set_vision/tools/segmentation_tools.py (2)

348-350: Excellent addition of explicit timeout with clear justification.

The explanatory comment clearly explains why a 60-second timeout is necessary for vision processing tasks, especially on CPU. This prevents indefinite waiting and provides better user experience.


356-356: Consistent timeout application for Grounded SAM service call.

Good consistency in applying the same 60-second timeout to the Grounded SAM service call, ensuring both vision processing steps have appropriate timeout handling.

src/rai_extensions/rai_open_set_vision/rai_open_set_vision/agents/base_vision_agent.py (2)

37-37: LGTM! Adding flag to track weight path initialization state.

The boolean flag helps prevent issues during weight re-downloading by ensuring path construction logic runs only once.


47-55: ```bash
#!/bin/bash

Print the _init_weight_path method for full context

sed -n '42,120p' src/rai_extensions/rai_open_set_vision/rai_open_set_vision/agents/base_vision_agent.py


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines 132 to 138
!!! note Source the setup shell

Ensure ROS 2 is sourced on the host machine. Ensure that every command inside the docker container is run in a sourced shell using `source setup_shell.sh`.

1. Launch the Robotic Arm Visualization on the host machine:

```shell
Copy link
Contributor

@coderabbitai coderabbitai bot Jun 26, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Missing export of ROS_DOMAIN_ID before it is referenced
The run command relies on $ROS_DOMAIN_ID, but newcomers might not have exported it yet.
Consider adding:

Before running the container:

```shell
export ROS_DOMAIN_ID=99   # choose the ID you used on the host

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[uncategorized] ~132-~132: Possible missing comma found.
Context: ...```  #### 2. Running the demo  !!! note Source the setup shell      Ensure ROS 2 is so...

(AI_HYDRA_LEO_MISSING_COMMA)

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

138-138: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

In docs/demos/manipulation.md around lines 132 to 138, the instructions use the
environment variable ROS_DOMAIN_ID without ensuring it is exported, which can
cause issues for new users. Add a note before the container run command
instructing users to export ROS_DOMAIN_ID with a chosen value, for example, by
adding a shell snippet: export ROS_DOMAIN_ID=99, to ensure the variable is set
in their environment before running the container.


</details>

<!-- This is an auto-generated reply by CodeRabbit -->

<!-- fingerprinting:phantom:triton:cougar -->

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified that the ROS_DOMAIN_ID variable should be exported on host machine in ba7f697

Copy link
Contributor

Choose a reason for hiding this comment

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

@Cytrus14 Perfect! Thank you for addressing that concern. Clarifying that ROS_DOMAIN_ID should be exported on the host machine will definitely help users avoid potential setup issues when running the Docker container.

  /|   /|  
 ( :v:  )
  |(_)|

🧠 Learnings used
Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:40-44
Timestamp: 2024-11-28T14:37:22.619Z
Learning: In the `rosbot-xl.launch.py` and `turtlebot.launch.py` launch files, the `run-nav.bash` scripts are different for each demo and should remain as separate calls to maintain clarity in the demo launches.

Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: examples/rosbot-xl.launch.py:34-38
Timestamp: 2024-11-28T14:35:45.411Z
Learning: The demo scripts and launch files in the `examples` directory are not yet implemented as ROS 2 packages, so `FindPackageShare` cannot be used to locate them.

Learnt from: boczekbartek
PR: RobotecAI/rai#324
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:57-69
Timestamp: 2024-11-28T15:46:06.103Z
Learning: In this project, prefer to keep ROS2 launch files simple and easy to use, and avoid adding non-standard features like executable verification and error handling unless necessary.

Learnt from: boczekbartek
PR: RobotecAI/rai#314
File: src/rai_bringup/launch/sim_whoami_demo.launch.py:0-0
Timestamp: 2024-12-02T13:51:47.310Z
Learning: In `sim_whoami_demo.launch.py`, the `robot_description_package` launch argument is already declared in the imported `rai_whoami_node` launch file `rai_whoami_node`, so it doesn't need to be redeclared in `sim_whoami_demo.launch.py`.

If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@Cytrus14 Cytrus14 requested a review from boczekbartek June 30, 2025 05:54
@Cytrus14 Cytrus14 force-pushed the dm/feat/docker-image-manipulator-demo branch from ba7f697 to 5fef90e Compare June 30, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants