# Drone Camera Gimbal Support Arm Optimization

## Engineering Scenario

**Application**: Professional aerial cinematography drone
**Component**: Camera gimbal support arm
**Goal**: Lightweight design for extended flight time while maintaining camera stability

## Problem Statement

The current production arm weighs **145g** and meets all requirements. Marketing wants to advertise "30% longer flight time" by reducing weight. Your task: optimize the arm geometry to minimize weight while ensuring it doesn't compromise camera stability or structural integrity.

### Real-World Constraints

- **Camera Payload**: 850g (camera + gimbal mechanism)
- **Maximum Deflection**: 1.5mm (required for image stabilization systems)
- **Material**: Aluminum 6061-T6 (aerospace grade)
- **Safety Factor**: 2.3 on yield strength (276 MPa)
- **Vibration Avoidance**: Natural frequency must be > 150 Hz to avoid coupling with rotor frequencies (80-120 Hz)

## Multi-Objective Optimization

This study explores the **trade-off between two competing objectives**:

### Objectives
1. **MINIMIZE Mass** - Every gram saved increases flight time
   - Target: < 120g (17% weight savings)
   - Current: 145g baseline

2. **MAXIMIZE Fundamental Frequency** - Higher frequency = better vibration isolation
   - Target: > 150 Hz (safety margin above 80-120 Hz rotor range)
   - Trade-off: Lighter designs typically have lower frequencies

### Constraints
1. **Max Displacement** < 1.5mm under 850g load
2. **Max von Mises Stress** < 120 MPa (Al 6061-T6 yield = 276 MPa, SF = 2.3)
3. **Natural Frequency** > 150 Hz (hard requirement)

## Design Variables (Parametric Beam Model)

- **beam_half_core_thickness**: 20-30 mm (affects stiffness and weight)
- **beam_face_thickness**: 1-3 mm (face sheets for bending resistance)
- **holes_diameter**: 180-280 mm (lightening holes for weight reduction)
- **hole_count**: 8-14 (number of lightening holes)

## Expected Outcomes

- **Pareto Front**: Shows designs on the optimal trade-off curve between mass and frequency
- **Weight Savings**: 10-20% reduction from 145g baseline
- **Constraint Analysis**: Clear visualization of which constraints are active/limiting
- **Design Insights**: Understand how design variables affect both objectives

## Study Configuration

- **Protocol**: Protocol 11 (Multi-Objective Optimization)
- **Sampler**: NSGA-II (genetic algorithm for Pareto fronts)
- **Trials**: 30 (sufficient for Pareto front exploration)
- **Duration**: ~1-2 hours (2-4 minutes per trial)

## Files in This Study

```
drone_gimbal_arm_optimization/
├── 1_setup/
│   ├── model/
│   │   ├── Beam.prt              # Parametric beam geometry
│   │   ├── Beam_sim1.sim         # Simulation setup (needs modal analysis!)
│   │   └── Beam_fem1.fem         # Finite element mesh
│   ├── optimization_config.json   # Multi-objective config
│   └── workflow_config.json       # Extractor definitions
├── 2_results/                     # Created during optimization
│   ├── study.db                   # Optuna database
│   ├── optimization_history_incremental.json
│   └── ...
├── run_optimization.py            # Main execution script
├── NX_FILE_MODIFICATIONS_REQUIRED.md  # IMPORTANT: Read this first!
└── README.md                      # This file
```

## Before You Run

**CRITICAL**: You MUST modify the NX simulation files before running.

Read [NX_FILE_MODIFICATIONS_REQUIRED.md](NX_FILE_MODIFICATIONS_REQUIRED.md) for detailed instructions.

**Summary of Required Changes**:
1. Add **Modal Analysis Solution** (SOL 103) to extract natural frequencies
2. Update **static load** to 8.34 N (850g camera payload)
3. Verify **material** is Al 7075-T6

## Running the Optimization

```bash
# Quick test (5 trials, ~10-20 minutes)
cd studies/drone_gimbal_arm_optimization
python run_optimization.py --trials 5

# Full study (30 trials, ~1-2 hours)
python run_optimization.py --trials 30

# Resume existing study
python run_optimization.py --resume
```

## Monitoring in Dashboard

While optimization runs, monitor in real-time:

1. **Start Dashboard Backend** (separate terminal):
   ```bash
   cd atomizer-dashboard/backend
   python -m uvicorn api.main:app --reload --port 8000
   ```

2. **Start Dashboard Frontend** (another terminal):
   ```bash
   cd atomizer-dashboard/frontend
   npm run dev
   ```

3. **Open Browser**: http://localhost:3003

4. **Select Study**: drone_gimbal_arm_optimization

### Dashboard Features You'll See

- **Real-time trial updates** via WebSocket
- **Pareto front visualization** (mass vs frequency scatter plot)
- **Constraint violation tracking** (which trials failed which constraints)
- **Progress monitoring** (30 trials total)
- **New best notifications** when Pareto front expands

## Interpreting Results

### Pareto Front Analysis

The Pareto front will show:
- **Lower-left designs**: Lighter but lower frequency (more prone to vibration)
- **Upper-right designs**: Heavier but higher frequency (better vibration isolation)
- **Middle region**: Balanced trade-offs

### Selecting Final Design

Choose based on flight profile:
- **Stable hovering flights**: Select lighter design (mass priority)
- **Dynamic maneuvers**: Select higher frequency design (vibration priority)
- **Balanced missions**: Mid-Pareto design

### Constraint Active Check

Look for designs where:
- Displacement constraint is just satisfied (1.4-1.5mm) = efficient use of deflection budget
- Frequency constraint is marginally above 150 Hz = not over-designed
- Stress well below limit = safety margin confirmed

## Why This is Realistic

This scenario reflects real engineering trade-offs in aerospace:

1. **Weight vs Performance**: Classic aerospace dilemma
2. **Multi-Physics Constraints**: Static strength + dynamic vibration
3. **Safety Margins**: Realistic stress limits with safety factors
4. **Operational Requirements**: Specific to drone camera applications
5. **Pareto Decision-Making**: No single "best" design, requires engineering judgment

## Comparison with Bracket Study

Unlike the bracket study (single objective), this study shows:
- **Multiple optimal solutions** (Pareto set, not single optimum)
- **Trade-off visualization** (can't optimize both objectives simultaneously)
- **Richer decision support** (choose based on priorities)
- **More complex analysis** (static + modal)

## Next Steps After Optimization

1. **Review Pareto front** in dashboard
2. **Select 2-3 candidate designs** from different regions of Pareto front
3. **Detailed FEA verification** of selected candidates
4. **Fatigue analysis** for repeated flight cycles
5. **Prototype testing** to validate predictions
6. **Down-select** based on test results

## Technical Notes

- Uses **NSGA-II** multi-objective optimizer (Optuna)
- Handles **3 constraints** with penalty methods
- Extracts **4 quantities** from 2 different solutions (static + modal)
- Fully automated - no manual intervention during run
- Results compatible with all dashboard visualization features

## Questions?

This study demonstrates the full power of multi-objective optimization for real engineering problems. The Pareto front provides engineering insights that single-objective optimization cannot offer.
