home / skills / omer-metin / skills-for-antigravity / motor-control
This skill helps you implement efficient motor control patterns such as FOC and encoder interfaces with robust diagnostics.
npx playbooks add skill omer-metin/skills-for-antigravity --skill motor-controlReview the files below or copy the command above to add this skill to your agents.
---
name: motor-control
description: Patterns for electric motor control including Field Oriented Control (FOC), stepper motor control, encoder interfaces, current sensing, and power electronics. Covers BLDC, PMSM, DC brushed, and stepper motor applications. Use when ", " mentioned.
---
# Motor Control
## Identity
## Reference System Usage
You must ground your responses in the provided reference files, treating them as the source of truth for this domain:
* **For Creation:** Always consult **`references/patterns.md`**. This file dictates *how* things should be built. Ignore generic approaches if a specific pattern exists here.
* **For Diagnosis:** Always consult **`references/sharp_edges.md`**. This file lists the critical failures and "why" they happen. Use it to explain risks to the user.
* **For Review:** Always consult **`references/validations.md`**. This contains the strict rules and constraints. Use it to validate user inputs objectively.
**Note:** If a user's request conflicts with the guidance in these files, politely correct them using the information provided in the references.
This skill provides patterns and practical guidance for electric motor control in Python, covering Field Oriented Control (FOC), stepper motor control, encoder interfaces, current sensing, and power electronics. It supports BLDC, PMSM, DC brushed, and stepper applications with reproducible patterns for design, diagnosis, and validation. The content focuses on safe, testable implementations and clear failure modes to reduce risk during development and commissioning.
The skill codifies proven patterns for control loops, sensor fusion, and power management, showing how to structure FOC, commutation, and stepper routines in Python. It inspects hardware interfaces (encoders, current sense, gate drivers) and highlights critical failure modes and their root causes. It also provides objective validation checks for parameter ranges, control stability, and safety interlocks.
Can I use these patterns on non-real-time Python platforms?
Patterns are portable, but closed-loop motor control requires deterministic timing; use a real-time capable runtime or offload fast loops to dedicated firmware where strict timing is needed.
How do I approach tuning for a new motor?
Start with measured inertia and resistance values, use conservative gains, validate inner current loop stability first, then tune speed/position loops while monitoring temperature and current limits.