# ROS2 Docker Container Environment A containerized ROS2 development environment with GUI support and NVIDIA GPU acceleration. This Docker setup provides an isolated workspace for ROS2 development while maintaining seamless integration with your host filesystem. ## Features - **ROS2 Distribution**: Default `humble` (configurable) - **GUI Support**: X11 forwarding for ROS2 GUI applications - **GPU Support**: NVIDIA GPU acceleration (when available) - **Workspace Mounting**: Host `ws/` directory mounted with full permissions - **User Permissions**: Runs with matching host user/group IDs - **Sample Movie**: [video](https://youtu.be/2pLzEvx31iA) ## Prerequisites - **Docker**: Install following [Docker Engine installation guide](https://docs.docker.com/engine/install) - **Post-install Setup**: Configure Docker for [non-root usage](https://docs.docker.com/engine/install/linux-postinstall) - **NVIDIA Runtime** (optional): For GPU support, install [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) ## Quick Start 1. **Clone and navigate to repository** ```bash git clone git@github.com:Standard-Cognition/keypoint-db.git cd keypoint_db ``` 2. **Build the container** ```bash make ``` 3. **Run container** ```bash ./run_container.sh ``` 4. **Join from another terminal** (optional) ```bash ./join_container.sh ``` ### ROS2 Development Workflow Inside the container (`/home/user/ws`): **Install dependencies (first time only):** ```bash sudo apt-get update rosdep update rosdep install -i --from-path src --rosdistro ${ROS_DISTRO} -y ``` **Build workspace:** ```bash ./compile_and_source.sh ``` **Run rviz with a layout:** ```bash ros2 launch db_loader layout_visualization_launch.py json_file:=/home/user/ws/data/research.sc.s2016.json ``` **Outside of the container download the track csv file** ``` download from: https://drive.google.com/file/d/1sf924lEBK2VLuBmHUzGXUakn6blwY9r2/view?usp=sharing cp chunk_1971-03-29T03_20_00Z_1971-03-29T03_25_00Z.csv YOUR_FOLDER/Tracks/keypoint-db/ws/data/ ``` **Join from another terminal** ```bash ./join_container.sh ``` **Run the keypoint_publisher:** ```bash ros2 run db_loader keypoint_publisher data/chunk_1971-03-29T03_20_00Z_1971-03-29T03_25_00Z.csv ``` **From a 3rd terminal window, join the container** ```bash ./join_container.sh ``` **Run the visualization:** ```bash ros2 launch db_loader layout_visualization_launch.py json_file:=/home/user/ws/data/research.sc.s2016.json ``` ## Project Structure ``` dataset_ros2_container/ ├── Dockerfile # Container image definition ├── Makefile # Build automation ├── docker-compose.yml # Docker Compose configuration ├── .env # Environment variables ├── utils # Shared shell utilities ├── run_container.sh # Start container script ├── join_container.sh # Join running container script ├── ws/ # ROS2 workspace (mounted) │ ├── src/ # Your ROS2 packages │ ├── build/ # Build artifacts │ ├── install/ # Installation directory │ └── log/ # Build logs └── README.md # This file ``` ## Configuration ### Environment Variables - `ROS2_DISTRO`: ROS2 distribution (default: from `.env` file) - `IMAGE_NAME`: Docker image name (default: `ros2_devel`) - `APT_MIRROR`: APT mirror location (default: `jp`) - `DOCKER_BUILD_OPTS`: Additional Docker build options ### Container Features - **X11 Forwarding**: Automatic GUI application support - **NVIDIA GPU**: Auto-detected and enabled when available - **Network**: Host networking for ROS2 communication - **Workspace Persistence**: `ws/` directory changes persist on host ## Troubleshooting **GPU not detected:** - Ensure NVIDIA drivers are installed on host - Install nvidia-container-toolkit - Verify with `nvidia-smi` command **Permission issues:** - Container runs with host user/group IDs automatically - Ensure Docker post-install steps completed **GUI applications not working:** - Verify X11 forwarding: `echo $DISPLAY` - Check XAUTH permissions in container **Build failures:** - Use `--no-cache` build option - Update base images with `--pull=true` ## Contributing 1. Fork the repository 2. Create feature branch: `git checkout -b feature-name` 3. Commit changes: `git commit -am 'Add feature'` 4. Push branch: `git push origin feature-name` 5. Submit pull request ## License See [LICENSE](LICENSE) file for details.