Agent skill
mpc-horizon-tuning
Selecting MPC prediction horizon and cost matrices for web handling.
Install this agent skill to your Project
npx add-skill https://github.com/benchflow-ai/skillsbench/tree/main/tasks-no-skills/r2r-mpc-control/environment/skills/mpc-horizon-tuning
SKILL.md
MPC Tuning for Tension Control
Prediction Horizon Selection
Horizon N affects performance and computation:
- Too short (N < 5): Poor disturbance rejection
- Too long (N > 20): Excessive computation
- Rule of thumb: N ≈ 2-3× settling time / dt
For R2R systems with dt=0.01s: N = 5-15 typical
Cost Matrix Design
State cost Q: Emphasize tension tracking
Q_tension = 100 / T_ref² # High weight on tensions
Q_velocity = 0.1 / v_ref² # Lower weight on velocities
Q = diag([Q_tension × 6, Q_velocity × 6])
Control cost R: Penalize actuator effort
R = 0.01-0.1 × eye(n_u) # Smaller = more aggressive
Trade-offs
| Higher Q | Effect |
|---|---|
| Faster tracking | More control effort |
| Lower steady-state error | More aggressive transients |
| Higher R | Effect |
|---|---|
| Smoother control | Slower response |
| Less actuator wear | Higher tracking error |
Terminal Cost
Use LQR solution for terminal cost to guarantee stability:
P = solve_continuous_are(A, B, Q, R)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
csv-processing
Use this skill when reading sensor data from CSV files, writing simulation results to CSV, processing time-series data with pandas, or handling missing values in datasets.
pid-controller
Use this skill when implementing PID control loops for adaptive cruise control, vehicle speed regulation, throttle/brake management, or any feedback control system requiring proportional-integral-derivative control.
yaml-config
Use this skill when reading or writing YAML configuration files, loading vehicle parameters, or handling config file parsing with proper error handling.
simulation-metrics
Use this skill when calculating control system performance metrics such as rise time, overshoot percentage, steady-state error, or settling time for evaluating simulation results.
vehicle-dynamics
Use this skill when simulating vehicle motion, calculating safe following distances, time-to-collision, speed/position updates, or implementing vehicle state machines for cruise control modes.
web-interface-guidelines
Vercel's comprehensive UI guidelines for building accessible, performant web interfaces. Use this skill when reviewing or building UI components for compliance with best practices around accessibility, performance, animations, and visual stability.
Didn't find tool you were looking for?