Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

attitude-controller-planner

/attitude-controller-planner

Implementuje wewnętrzną pętlę sterowania kwadrokoptera: regulator PID orientacji (roll, pitch, yaw) i planer orientacji, który zamienia żądane przyspieszenie na kąty Eulera.

Repozytorium
skillsbench ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
12.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 12.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Implementuje wewnętrzną pętlę sterowania kwadrokoptera: regulator PID orientacji (roll, pitch, yaw) i planer orientacji, który zamienia żądane przyspieszenie na kąty Eulera.

Oryginalny opis (EN)

Use this skill when implementing the inner control loop for a quadrotor — attitude (roll/pitch/yaw) PID control and attitude planning (converting desired acceleration to desired Euler angles). Covers gain layout, integral reset pattern, and the attitude planner inverse kinematics.

Jak działa

  1. Overview
  2. Attitude Planner
  3. Attitude Controller
  4. Gain Tuning
  5. Critical Design Rules
  6. Tuning Guidelines
  7. Integration in Main Loop
Sekcje z nagłówków SKILL.md, w oryginale · 63 linii, 372 słów
Podgląd SKILL.md
---
name: attitude-controller-planner
description: Use this skill when implementing the inner control loop for a quadrotor — attitude (roll/pitch/yaw) PID control and attitude planning (converting desired acceleration to desired Euler angles). Covers gain layout, integral reset pattern, and the attitude planner inverse kinematics.
---

# Attitude Controller and Planner

## Overview

Two cooperating modules form the inner loop:

1. **Attitude planner** — converts desired linear acceleration → desired roll/pitch angles (φ_des, θ_des)
2. **Attitude controller** — PID feedback on Euler angle errors → moments [M₁, M₂, M₃]

## Attitude Planner

### Implementation Logic

Given desired acceleration `[ax, ay]` and current yaw `ψ`, compute desired roll/pitch via inverse kinematics:

- `φ_des` is proportional to `(ax·sin(ψ) − ay·cos(ψ)) / g`
- `θ_des` is proportional to `(ax·cos(ψ) + ay·sin(ψ)) / g`

Return `rot = [φ_des, θ_des, ψ]` and `omega = [0, 0, desired_yaw_rate]`.

## Attitude Controller

### Implementation Logic

PID control on Euler angle errors, scaled by the inertia matrix:

1. Compute angle error: `e = desired_rot − current_rot` (element-wise, 3D vector).
2. Accumulate integral: `integral_e += e * dt`.
3. Compute moment: `M = I @ (kp * e + ki * integral_e + kd * (desired_omega − current_omega))`.

Use `make_attitude_integral()` to create a fresh `{"e": zeros(3)}` dict before the simulation loop. Never use a mutable default argument for this state.

## Gain Tuning
No tuning range is provided — choose PID gains freely to best satisfy the success criteria. Start with small values (e.g. `kp_att = [100, 100, 50]`, `ki_att = [0.0, 0.0, 0.0]`, `kd_att = [0.0, 0.0, 0.0]`) and increase gradually.

## Critical Design Rules

- **Never use a mutable default for the integral** — this causes wind-up across simulation runs. Always pass `integral` explicitly and create it with `make_attitude_integral()` before the loop.
- **Ki should be small** (≤ 0.5 for attitude) — attitude integral wind-up causes x/y oscillations during z-only maneuvers.
- `dt = 1.0 / params['sample_rate']` — never hardcode `0.005`.
- Gains are arrays `[phi, theta, psi]`; multiply element-wise, not matrix multiply, before the inertia `@`.

## Tuning Guidelines

| Symptom | Fix |
|---|---|
| Slow roll/pitch correction | Increase `kp_att[0]` or `kp_att[1]` |
| Roll/pitch oscillates | Increase `kd_att[0]` or `kd_att[1]` |
| Yaw drifts slowly | Increase `ki_att[2]` |
| x/y oscillation during hover | Decrease `ki_att` |

## Integration in Main Loop

```python
att_integral = make_attitude_integral()   # once before the loop

for iter_ in range(max_iter - 1):
    ...
    desired_state.rot, desired_state.omega = attitude_planner(desired_state, params)
    M = attitude_controller(current_state, desired_state, params, att_integral)
```

Wersje

W bazie nie ma innych skilli o nazwie attitude-controller-planner.

Migawka bazy z 13.11.2026 · wersja paczki cc08acb55ceb (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100position-controller-trajectory-planner
    Implementuje zewnętrzną pętlę sterowania quadrotora: regulator PID pozycji (błąd pozycji i prędkości na ciąg i przyspieszenie) oraz planowanie trajektorii z punktów planu lotu do macierzy stanu.
  • 100tapkit-motion
    Wykorzystuje ruch dłoni TAP z prędkości myszy i orientacji roll, pitch i yaw do przesuwania kursora lub obracania.
  • 100tap-imu-motion
    Wykorzystuje ruch dłoni z Tap, czyli dane IMU i zdarzenia myszy, do sterowania kursorem i interfejsem sterowanym pochyleniem.
  • 100pid-controller
    Pomaga implementować pętle regulacji PID w tempomacie adaptacyjnym, regulacji prędkości pojazdu, gazie i hamulcu oraz innych układach ze sprzężeniem zwrotnym.
  • 95pywayne-ahrs-tools
    Rozkłada kwaternion na kąty Eulera i kompensuje przechylenie oraz pochylenie do zera w module pywayne.ahrs.tools dla systemów AHRS.
  • 100tap-android-imu-motion
    Wykorzystuje ruch dłoni z Tap na Androidzie, czyli dane IMU i zdarzenia myszy, do sterowania kursorem, skrętem lub obrotem.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.