A dockerized setup for Eclipse Cyclone DDS with SpatialDDS protocol implementation, including comprehensive test applications for both basic DDS functionality and SpatialDDS VPS (Visual Positioning Service) scenarios.
This project provides:
- Docker container with Cyclone DDS built from source
- Complete SpatialDDS v1.2 protocol implementation
- VPS (Visual Positioning Service) mock implementation
- Comprehensive test suite with detailed message logging
- IDL definitions for SpatialDDS data structures
- Docker Compose configuration for distributed testing
- Docker (version 20.10 or later)
- Docker Compose (version 2.0 or later)
docker build -t cyclonedds-python .Test both DDS and SpatialDDS functionality:
docker run --rm --network host cyclonedds-pythonThis runs the comprehensive test suite that validates:
- Cyclone DDS environment setup and basic functionality
- SpatialDDS IDL compilation
- VPS service announcement and discovery
- Client-server request/response flow with mock sensor data
- Detailed message logging and protocol visualization
Using Docker Compose to run both publisher and subscriber:
# Start both services
docker-compose up
# Or run in detached mode
docker-compose up -d
# View logs
docker-compose logs -fRun the comprehensive test suite (default):
docker run --rm --network host cyclonedds-pythonRun specific test modes:
# Only basic DDS tests
docker run --rm --network host cyclonedds-python python3 comprehensive_test.py --mode basic
# Only SpatialDDS tests
docker run --rm --network host cyclonedds-python python3 comprehensive_test.py --mode spatial
# Only IDL compilation tests
docker run --rm --network host cyclonedds-python python3 comprehensive_test.py --mode idl
# Interactive SpatialDDS demo
docker run --rm --network host -it cyclonedds-python python3 comprehensive_test.py --mode demoRun the SpatialDDS test directly:
# Default: Show message content (without large sensor data)
docker run --rm --network host cyclonedds-python python3 spatialdds_test.py
# Show detailed content including full sensor data
docker run --rm --network host cyclonedds-python python3 spatialdds_test.py --detailed
# Show only message headers (no content)
docker run --rm --network host cyclonedds-python python3 spatialdds_test.py --summary-onlyRun basic DDS diagnostic test:
docker run --rm --network host cyclonedds-python python3 simple_test.pyTest throughput:
docker run --rm --network host cyclonedds-python ddsperf pub size 1k &
docker run --rm --network host cyclonedds-python ddsperf subTest latency:
docker run --rm --network host cyclonedds-python ddsperf ping &
docker run --rm --network host cyclonedds-python ddsperf pongRun sanity check:
docker run --rm --network host cyclonedds-python ddsperf sanityCompile IDL files:
docker run --rm -v $(pwd):/data cyclonedds-python idlc /data/your_file.idlTest VPS (Visual Positioning Service) workflow:
# Complete SpatialDDS VPS workflow test
docker run --rm --network host cyclonedds-python python3 spatialdds_test.pyCompile SpatialDDS IDL definitions:
# Generate Python bindings from IDL
docker run --rm -v $(pwd):/output cyclonedds-python idlc -l py -o /output spatialdds.idlThe SpatialDDS test demonstrates:
- Service Discovery: VPS announces capabilities, client discovers services
- Sensor Data Exchange: Mock camera, IMU, and GPS data transmission
- Pose Estimation: VPS processes sensor data and returns pose estimates
- Feature Extraction: Visual feature points and descriptors
- Anchor Management: Persistent world-anchored reference points
- Detailed Logging: Complete message flow with JSON content visualization
- Default Mode: Shows all message content with large data fields truncated for readability
- Detailed Mode: Shows complete message content including full sensor data payloads
- Summary Mode: Shows only message headers, timing, and sizes without content
- Custom Fields: Key fields like request_id, success status, and confidence are always shown
The test application supports several command-line options:
python test_app.py --help--mode: Choose betweenpublisher,subscriber, ortest(default: test)--duration: Duration to run in seconds (default: 10)--interval: Publisher message interval in seconds (default: 1.0)
This setup uses network_mode: host for Docker containers to ensure proper DDS communication. This is required because:
- DDS uses UDP multicast for discovery
- Host networking allows containers to communicate using the host's network interface
- Proper IP addressing is maintained for DDS participants
Note: Host networking may not work on Docker Desktop for Windows/macOS. In these environments, you may need to adjust the network configuration.
.
├── Dockerfile # Multi-stage build for Cyclone DDS
├── docker-compose.yml # Container orchestration
├── requirements.txt # Python dependencies
├── test_app.py # Test application
└── README.md # This file
The Dockerfile uses a multi-stage build:
- Builder stage: Compiles Cyclone DDS from source with required features
- Runtime stage: Creates a lean production image with Python bindings
Key features:
- Based on Python 3.10 (3.11 has known installation issues)
- Cyclone DDS built with
ENABLE_TYPELIB=ON - Non-root user for security
- Proper environment variable setup
The test_app.py includes:
- Publisher: Sends test messages with timestamps and counters
- Subscriber: Listens for and displays received messages
- Test Mode: Validates DDS initialization and basic functionality
- Error Handling: Comprehensive error reporting and cleanup
-
Import Error: If you see
ImportError: cannot import name 'IdlStruct'- This usually indicates cyclonedds installation issues
- Rebuild the Docker image with
--no-cacheflag
-
Network Issues: If containers can't communicate
- Ensure host networking is working on your platform
- Check firewall settings for UDP ports 7400-7500
-
Build Failures: If Docker build fails
- Check available disk space
- Ensure internet connectivity for downloading dependencies
# Check if Cyclone DDS is properly installed
docker run --rm cyclonedds-python cyclonedds --version
# Check Python bindings
docker run --rm cyclonedds-python python -c "import cyclonedds; print('Success')"
# Run comprehensive test
docker run --rm --network host cyclonedds-python python test_app.py --mode testRun with verbose output:
docker run --rm --network host -e CYCLONEDDS_URI='<General><NetworkInterfaceAddress>auto</NetworkInterfaceAddress></General>' cyclonedds-pythonTo modify the test application:
- Edit
test_app.pylocally - Use volume mounts to test changes without rebuilding:
docker run --rm --network host -v $(pwd):/app cyclonedds-python python test_app.py- Fork the repository
- Create a feature branch
- Test your changes with the provided test suite
- Submit a pull request
This project follows the Eclipse Cyclone DDS licensing terms.