File size: 4,681 Bytes
c9ea516 2ab61b6 c9ea516 2ab61b6 c9ea516 2ab61b6 c9ea516 2ab61b6 c9ea516 2ab61b6 c9ea516 b622683 06d23ba b622683 06d23ba b622683 caff9f9 48efaa5 b622683 48efaa5 b622683 b363835 c9ea516 b363835 c9ea516 2ab61b6 48efaa5 c9ea516 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# 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.
|