A sophisticated multi-agent system combining natural language processing with ROS integration and scientific analysis capabilities, powered by optimized open-source LLMs from Hugging Face.
graph TB
subgraph LLM Agents
A[Terminal Commander] -->|Natural Language| B[ROS Integration]
C[Plot Analyzer] -->|OCR + Analysis| D[PDF Reporting]
B --> E[ROS Node Management]
end
subgraph Infrastructure
F[Local LLMs] --> G[TinyLlama-1.1B]
F --> H[Mistral-7B]
I[ROS Core] --> J[roscore]
end
File: terminal_commander.py
- Natural language to terminal command translation
- ROS-specific command handling
- Automatic roscore management
- Terminal emulator detection (Linux/macOS/Windows)
- Command history and context awareness
- Safety checks for dangerous commands
python3 terminal_commander.py
> start mission with exploration parameters
> launch rostopic list
> explain roslaunch package file.launch
File: plot_analyzer.py
- High-precision OCR with image preprocessing
- Structured technical analysis template
- Quantitative metrics extraction
- Automated PDF report generation
- GPU-optimized inference
python3 plot_analyzer.py scientific_plot.png --output analysis.pdf
Agent | Model | Size | VRAM | CPU RAM | Quantization |
---|---|---|---|---|---|
Terminal Commander | TinyLlama-1.1B | ~0.8GB | 2GB | 4GB | Q4_K_M |
Plot Analyzer | Mistral-7B | ~4.2GB | 6GB | 8GB | Q4_K_M |
Operation | Latency (CPU) | Throughput |
---|---|---|
Command Translation | 0.8-1.2s | 12-15 req/min |
Plot Analysis | 3-5s | 8-10 req/min |
ROS Node Launch | Instant | N/A |
# Base system
sudo apt install python3-pip tesseract-ocr poppler-utils
# Python requirements
pip install llama-cpp-python pillow pytesseract fpdf2 rospkg
# Terminal Commander model
wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
# Plot Analyzer model
wget https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_M.gguf
# For GPU acceleration
export CUDA_VISIBLE_DEVICES=0
# For ROS integration
export ROS_MASTER_URI=http://localhost:11311
Parameter | Description | Default |
---|---|---|
--gpu_layers |
Number of layers to offload to GPU | 40 |
--n_threads |
CPU threads for inference | All available |
--temperature |
LLM creativity (0-1) | 0.2 |
- Start rosbridge server:
roslaunch rosbridge_server rosbridge_websocket.launch
- Supported ROS Commands:
- Automatic roscore management
- ROS node launching
- Topic monitoring
- Parameter setting
-
Command Validation:
- Blocks dangerous shell patterns (rm -rf, chmod, etc.)
- ROS command sandboxing
-
Content Filtering:
- LLM output validation
- Template enforcement
-
Resource Limits:
- Memory constraints
- Timeout handling
> start exploration mission with 5 waypoints
[System] Launching ROS nodes for mission planning...
python plot_analyzer.py research_figure.png --output paper_analysis.pdf
> how do I check ROS topics?
[Assistant] Running: rostopic list
Issue | Solution |
---|---|
Model loading fails | Verify GGUF file integrity |
ROS connection issues | Check roscore is running |
OCR inaccuracies | Preprocess images with PIL |
GPU out of memory | Reduce --gpu_layers |
MIT License - See LICENSE for details.
- Fork the repository
- Create feature branch (
git checkout -b feature/improvement
) - Commit changes (
git commit -am 'Add new feature'
) - Push to branch (
git push origin feature/improvement
) - Open Pull Request
Note: For production deployment, consider implementing additional security measures and monitoring for the LLM interactions.