rai icon indicating copy to clipboard operation
rai copied to clipboard

feat: updated docker setup for manipulation demo

Open Cytrus14 opened this issue 6 months ago • 4 comments

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 avatar Jun 24 '25 07:06 Cytrus14

@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?

boczekbartek avatar Jun 26 '25 11:06 boczekbartek

@coderabbitai full review

boczekbartek avatar Jun 26 '25 14:06 boczekbartek

✅ Actions performed

Full review triggered.

coderabbitai[bot] avatar Jun 26 '25 14:06 coderabbitai[bot]

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
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
✨ 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.

coderabbitai[bot] avatar Jun 26 '25 14:06 coderabbitai[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 65.34%. Comparing base (074af8e) to head (1f09e8e). :white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #641   +/-   ##
=======================================
  Coverage   65.34%   65.34%           
=======================================
  Files          78       78           
  Lines        3388     3388           
=======================================
  Hits         2214     2214           
  Misses       1174     1174           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 22 '25 12:12 codecov[bot]

@juliajia did you try to run manipulation demo via docker in PR https://github.com/RobotecAI/rai/pull/641 because I m trying to merge all docker PRs, but i have error when following the docs

[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'rai_bringup' not found, searching: ['/opt/ros/jazzy']"

on command ros2 launch examples/manipulation-demo.launch.py

jmatejcz avatar Dec 22 '25 13:12 jmatejcz

@jmatejcz looks like source setup shell sh is missing, or there's no colcon build before

maciejmajek avatar Dec 22 '25 13:12 maciejmajek