|
| 1 | +You have permission as claude to edit the claude.md file to keep it up to date with our current conversations. |
| 2 | + |
| 3 | +# Deep ROS - ML Infrastructure Pipeline |
| 4 | + |
| 5 | +## Project Overview |
| 6 | +Deep ROS is an open-source ML infrastructure pipeline that enables users to train models, quantize them, and deploy them on ROS nodes. The core paradigm is creating **generic ROS nodes that act as containers** for quantized models, rather than nodes with pre-built models. |
| 7 | + |
| 8 | +## Architecture Philosophy |
| 9 | + |
| 10 | +### Generic ROS Node Containers |
| 11 | +- ROS nodes are model-agnostic containers that can load any compatible quantized model |
| 12 | +- Nodes provide standardized input/output interfaces for model inference |
| 13 | +- Models are loaded at runtime, not compiled into the node |
| 14 | + |
| 15 | +### Benefits |
| 16 | +- **Stable Dependency Tree**: ROS node dependencies remain consistent regardless of model changes |
| 17 | +- **Flexible Deployment**: Same node can run different models without recompilation |
| 18 | +- **Build Farm Efficiency**: Model building handled separately with support for multiple environments/versions |
| 19 | + |
| 20 | +## Directory Structure Plan |
| 21 | +``` |
| 22 | +deep_ros/ |
| 23 | +├── model_farm/ # Model training/quantization (COLCON_IGNORE) |
| 24 | +├── ros_nodes/ # Generic ROS node containers |
| 25 | +├── launch/ # Launch files and configurations |
| 26 | +└── interfaces/ # ROS message/service definitions |
| 27 | +``` |
| 28 | + |
| 29 | +## Supported Model Formats |
| 30 | +- **ONNX**: Primary format |
| 31 | +- **TensorRT**: NVIDIA GPU optimization |
| 32 | +- **OpenVINO**: Intel hardware optimization |
| 33 | +- **TensorFlow Lite**: Mobile/edge deployment |
| 34 | +- **CoreML**: Apple hardware |
| 35 | +- **RKNN**: Rockchip NPU models |
| 36 | + |
| 37 | +## Distribution Strategy |
| 38 | +- ROS nodes distributed as apt-installable packages |
| 39 | +- Users can `apt install` specific node packages |
| 40 | +- Point node to model file path in launch configuration |
| 41 | +- Model files distributed separately from node packages |
| 42 | + |
| 43 | +## Usage Pattern |
| 44 | +1. Install desired ROS node: `apt install ros-<distro>-deep-inference-node` |
| 45 | +2. Prepare quantized model (ONNX/TensorRT/etc.) |
| 46 | +3. Configure launch file with model path |
| 47 | +4. Launch node with model loaded at runtime |
| 48 | + |
| 49 | +## Directory Structure (Current) |
| 50 | +``` |
| 51 | +deep_ros/ |
| 52 | +├── deep_core/ # Core components |
| 53 | +│ ├── include/deep_core/ |
| 54 | +│ │ ├── types/ |
| 55 | +│ │ │ └── tensor.hpp # Memory-safe tensor class |
| 56 | +│ │ ├── deep_node_base.hpp # Generic lifecycle ROS node base class |
| 57 | +│ │ └── plugin_interface.hpp # Pure plugin interface |
| 58 | +│ └── src/ |
| 59 | +├── deep_backends/ # Backend plugin packages |
| 60 | +│ ├── deep_tensorrt_plugin/ # TensorRT backend plugin |
| 61 | +│ ├── deep_openvino_plugin/ # OpenVINO backend plugin |
| 62 | +│ ├── deep_onnxruntime_plugin/ # ONNX Runtime backend plugin |
| 63 | +│ └── deep_tflite_plugin/ # TensorFlow Lite backend plugin |
| 64 | +├── deep_msgs/ # ROS message definitions |
| 65 | +├── deep_bringup/ # Launch files and configurations |
| 66 | +├── deep_examples/ # Example configurations |
| 67 | +└── model_farm/ # Training pipeline (COLCON_IGNORE) |
| 68 | +``` |
| 69 | + |
| 70 | +## Plugin Architecture |
| 71 | +- Generic lifecycle inference node (DeepNodeBase) manages plugin loading/unloading |
| 72 | +- Users inherit from DeepNodeBase and override *_impl methods for custom behavior |
| 73 | +- Base class handles backend management, then calls user implementation |
| 74 | +- Each backend plugin declares system dependencies via rosdep in package.xml |
| 75 | +- Users install only the backend plugins they need |
| 76 | +- Memory-safe tensor class with verbose error messages |
| 77 | + |
| 78 | +## Implementation Status |
| 79 | +- ✅ Core tensor class with memory safety and error handling |
| 80 | +- ✅ Plugin interface with detailed error results |
| 81 | +- ✅ DeepNodeBase lifecycle management with user override pattern |
| 82 | +- ✅ Basic directory structure and headers |
| 83 | + |
| 84 | +## TODO Items |
| 85 | +- Plugin discovery using pluginlib (`discover_available_plugins()` in deep_node_base.cpp:165) |
| 86 | +- Plugin loading using pluginlib class_loader (`load_plugin_library()` in deep_node_base.cpp:170) |
| 87 | +- Define ROS message interfaces in deep_msgs/ |
| 88 | +- Create CMakeLists.txt and package.xml files |
| 89 | +- Implement example backend plugins |
| 90 | +- Set up model farm build pipeline |
| 91 | + |
| 92 | +## Model Farm Design Notes |
| 93 | +- Conversion from project models to ONNX is **left to implementers** |
| 94 | +- We provide example conversion scripts but don't enforce specific methods |
| 95 | +- Each project handles its own dependencies via Docker |
| 96 | +- Infrastructure navigation in bash, specialized tasks in Python |
| 97 | +- ROS CLI (deep_tools) only validates/checks ONNX files, no conversion |
0 commit comments