Scripts Guide
π€ Script Architecture
miniROS provides a fully integrated script system, following the βminiβ philosophy: minimum scripts, maximum functionality.
π Scripts Directory Structure
scripts/
βββ setup.sh # π§ Unified setup script (all-in-one)
βββ mini_ros_wrapper.sh # π€ Smart CLI wrapper
π Main Setup Script: setup.sh
π― Philosophy
One script, all miniROS needs - Unified script handles all installation, configuration, and maintenance tasks.
π Available Commands
# Complete setup (recommended for new users)
bash scripts/setup.sh
# Show help and all commands
bash scripts/setup.sh help
# Build CLIs only (no environment configuration)
bash scripts/setup.sh build
# Setup environment only (if CLIs already built)
bash scripts/setup.sh env
# Test current installation
bash scripts/setup.sh test
# Clean build artifacts
bash scripts/setup.sh clean
π§ What It Does
Complete Setup (bash scripts/setup.sh
)
- π¨ Builds Rust CLI - Compiles
mini_ros
binary - π Installs Python CLI - Installs
mini_ros_py
package - π§ Configures Environment - Adds PATH, aliases, completions
- π Backs Up Configs - Safely backs up shell config files
- π§ͺ Tests Installation - Verifies everything works
- π‘ Shows Next Steps - Guides you on usage
Build Only (bash scripts/setup.sh build
)
- Builds both Rust and Python CLIs
- No environment modification
- Perfect for CI/CD or when you want manual control
Environment Only (bash scripts/setup.sh env
)
- Configures shell environment (PATH, aliases, completions)
- Assumes CLIs are already built
- Useful for setting up new terminals
Test (bash scripts/setup.sh test
)
- Checks if CLIs are built and functional
- Verifies environment setup
- Great for troubleshooting
Clean (bash scripts/setup.sh clean
)
- Removes build artifacts
- Cleans both Rust and Python builds
- Fresh start capability
π‘οΈ Safety Features
- Automatic Backups - Shell configs backed up with timestamps
- Duplicate Detection - Wonβt add duplicate PATH entries
- Error Handling - Graceful failure with helpful messages
- Shell Detection - Supports bash, zsh, fish automatically
π€ Smart Wrapper: mini_ros_wrapper.sh
π― Philosophy
Automatic tool selection - Uses the best CLI for each task without user intervention.
π§ Smart Logic
# System operations β Rust CLI (high performance)
bash scripts/mini_ros_wrapper.sh pkg list
bash scripts/mini_ros_wrapper.sh launch turtlebot simulation
# Python operations β Python CLI (specialized)
bash scripts/mini_ros_wrapper.sh examples list
bash scripts/mini_ros_wrapper.sh test --coverage
# Fallback β Python CLI if Rust unavailable
π Selection Rules
Command | CLI Choice | Reason |
---|---|---|
pkg | Rust | Package management performance |
launch | Rust | System orchestration |
run | Rust | Node execution performance |
examples | Python | Python-specific functionality |
test | Python | Python testing suite |
install | Python | Python package management |
run --list | Python | Python examples listing |
π‘ Usage Examples
# These automatically choose the optimal CLI:
bash scripts/mini_ros_wrapper.sh pkg list
bash scripts/mini_ros_wrapper.sh examples list
bash scripts/mini_ros_wrapper.sh launch turtlebot simulation
bash scripts/mini_ros_wrapper.sh test --verbose
π Workflow Integration
π First Time Setup
# Clone repository
git clone https://github.com/ruziniuuuuu/miniROS-rs
cd miniROS-rs
# One-command setup
bash scripts/setup.sh
# Restart terminal or source config
source ~/.zshrc
π Daily Development
# Use direct commands (post-setup)
mini_ros pkg list
mini_ros_py examples list
# Or use smart wrapper
bash scripts/mini_ros_wrapper.sh pkg info turtlebot
bash scripts/mini_ros_wrapper.sh examples install ~/my-examples
π§Ή Maintenance
# Test installation
bash scripts/setup.sh test
# Clean and rebuild
bash scripts/setup.sh clean
bash scripts/setup.sh build
# Update environment (new terminal)
bash scripts/setup.sh env
π Shell Support
β Fully Supported
- bash -
.bashrc
configuration - zsh -
.zshrc
configuration - fish -
config.fish
configuration
π§ What Gets Added
Bash/Zsh Configuration
# miniROS CLI PATH (auto-generated)
if [ -d "/path/to/miniROS-rs/target/debug" ]; then
export PATH="/path/to/miniROS-rs/target/debug:$PATH"
fi
# miniROS conveniences
alias mrs="mini_ros"
alias mrspy="mini_ros_py"
alias mrsw="bash /path/to/miniROS-rs/scripts/mini_ros_wrapper.sh"
# miniROS completion (if available)
if command -v mini_ros >/dev/null 2>&1; then
if [ -n "$BASH_VERSION" ]; then
eval "$(mini_ros completions bash 2>/dev/null || true)"
elif [ -n "$ZSH_VERSION" ]; then
eval "$(mini_ros completions zsh 2>/dev/null || true)"
fi
fi
Fish Configuration
# miniROS CLI PATH (auto-generated)
if test -d "/path/to/miniROS-rs/target/debug"
set -gx PATH "/path/to/miniROS-rs/target/debug" $PATH
end
# miniROS conveniences
alias mrs="mini_ros"
alias mrspy="mini_ros_py"
alias mrsw="bash /path/to/miniROS-rs/scripts/mini_ros_wrapper.sh"
π― Best Practices
1. Use Complete Setup First
bash scripts/setup.sh # Recommended for all users
2. Test Before Using
bash scripts/setup.sh test # Verify installation
3. Use Aliases for Speed
mrs pkg list # Short for mini_ros
mrspy examples # Short for mini_ros_py
mrsw pkg info # Smart wrapper
4. Clean When Issues Arise
bash scripts/setup.sh clean
bash scripts/setup.sh build
π Troubleshooting
Command Not Found
# Check installation
bash scripts/setup.sh test
# Reinstall environment
bash scripts/setup.sh env
# Source config manually
source ~/.zshrc
Build Failures
# Clean and rebuild
bash scripts/setup.sh clean
bash scripts/setup.sh build
Permission Issues
# Ensure scripts are executable
chmod +x scripts/*.sh
Philosophy: One script system, unlimited robotics potential π€β‘