[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BZDKBSBF4DWB53SC01SY7B":3,"skill-same:01M7BZDKBSBF4DWB53SC01SY7B":44},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7BZDKBSBF4DWB53SC01SY7B","attitude-controller-planner",null,"linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_clean_20261004_finalized\u002Ftasks\u002Fdrone-planning-control\u002Frepaired_skill\u002Fattitude-controller-planner\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: attitude-controller-planner\ndescription: Implement a quadrotor inner loop: attitude planning from desired acceleration plus PID attitude control to moments, with guidance to keep thrust and tilt dynamics consistent.\n---\n\n# Attitude Controller and Planner\n\n## Overview\n\nTwo cooperating modules form the inner loop:\n\n1. **Attitude planner** — converts desired linear acceleration → desired attitude (roll\u002Fpitch\u002Fyaw) and (optionally) desired body rates\n2. **Attitude controller** — PID feedback on attitude errors → moments `[Mx, My, Mz]`\n\n## Attitude Planner {#attitude-planner}\n\n### Implementation Logic\n\nPrefer a dynamically consistent planner: build the desired body z-axis from the **net force direction**, and ensure the thrust magnitude matches that same net force.\n\n```python\nimport numpy as np\n\ndef attitude_from_accel(acc_cmd, yaw_cmd, g=9.81):\n    e3 = np.array([0.0, 0.0, 1.0])\n    f_des = acc_cmd + g * e3\n\n    # Guard against near-freefall numerical issues.\n    if np.linalg.norm(f_des) \u003C 1e-6:\n        b3_des = e3\n    else:\n        b3_des = f_des \u002F np.linalg.norm(f_des)\n\n    b1_yaw = np.array([np.cos(yaw_cmd), np.sin(yaw_cmd), 0.0])\n    b2_des = np.cross(b3_des, b1_yaw)\n    b2_des = b2_des \u002F max(np.linalg.norm(b2_des), 1e-6)\n    b1_des = np.cross(b2_des, b3_des)\n\n    R_des = np.column_stack([b1_des, b2_des, b3_des])\n    thrust = np.linalg.norm(f_des)  # multiply by mass in the outer loop\n    return R_des, thrust\n```\n\n**Decision rule:** use small-angle roll\u002Fpitch inverse kinematics only when you can bound tilts to be tiny *and* the thrust computation is derived from the same approximation; otherwise, use the geometric construction above.\n\n## Attitude Controller\n\n### Implementation Logic\n\nPID control on Euler angle errors, scaled by the inertia matrix:\n\n1. Compute angle error: `e = desired_rot − current_rot` (element-wise, 3D vector).\n2. Accumulate integral: `integral_e += e * dt`.\n3. Compute moment: `M = I @ (kp * e + ki * integral_e + kd * (desired_omega − current_omega))`.\n\nUse `make_attitude_integral()` to create a fresh `{\"e\": zeros(3)}` dict before the simulation loop. Never use a mutable default argument for this state.\n\n## Gain Tuning\nNo 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.\n\n## Critical Design Rules\n\n- **Keep thrust and tilt consistent.** If lateral acceleration is commanded, the vehicle must tilt; therefore thrust magnitude must increase so its vertical component still supports gravity while its horizontal component tracks the command. A common consistent form is `F = m * ||a_cmd + g e3||` with attitude derived from the same vector.\n- **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.\n- **Ki should be small** (≤ 0.5 for attitude) — attitude integral wind-up causes x\u002Fy oscillations during z-only maneuvers.\n- `dt = 1.0 \u002F params['sample_rate']` — never hardcode `0.005`.\n- Gains are arrays `[phi, theta, psi]`; multiply element-wise, not matrix multiply, before the inertia `@`.\n\n## Tuning Guidelines\n\n| Symptom | Fix |\n|---|---|\n| Slow roll\u002Fpitch correction | Increase `kp_att[0]` or `kp_att[1]` |\n| Roll\u002Fpitch oscillates | Increase `kd_att[0]` or `kd_att[1]` |\n| Yaw drifts slowly | Increase `ki_att[2]` |\n| x\u002Fy oscillation during hover | Decrease `ki_att` |\n\n## Integration in Main Loop\n\n```python\natt_integral = make_attitude_integral()   # once before the loop\n\nfor iter_ in range(max_iter - 1):\n    ...\n    desired_state.rot, desired_state.omega = attitude_planner(desired_state, params)\n    M = attitude_controller(current_state, desired_state, params, att_integral)\n```\n","# Attitude Controller and Planner\n\n## Overview\n\nTwo cooperating modules form the inner loop:\n\n1. **Attitude planner** — converts desired linear acceleration → desired attitude (roll\u002Fpitch\u002Fyaw) and (optionally) desired body rates\n2. **Attitude controller** — PID feedback on attitude errors → moments `[Mx, My, Mz]`\n\n## Attitude Planner {#attitude-planner}\n\n### Implementation Logic\n\nPrefer a dynamically consistent planner: build the desired body z-axis from the **net force direction**, and ensure the thrust magnitude matches that same net force.\n\n```python\nimport numpy as np\n\ndef attitude_from_accel(acc_cmd, yaw_cmd, g=9.81):\n    e3 = np.array([0.0, 0.0, 1.0])\n    f_des = acc_cmd + g * e3\n\n    # Guard against near-freefall numerical issues.\n    if np.linalg.norm(f_des) \u003C 1e-6:\n        b3_des = e3\n    else:\n        b3_des = f_des \u002F np.linalg.norm(f_des)\n\n    b1_yaw = np.array([np.cos(yaw_cmd), np.sin(yaw_cmd), 0.0])\n    b2_des = np.cross(b3_des, b1_yaw)\n    b2_des = b2_des \u002F max(np.linalg.norm(b2_des), 1e-6)\n    b1_des = np.cross(b2_des, b3_des)\n\n    R_des = np.column_stack([b1_des, b2_des, b3_des])\n    thrust = np.linalg.norm(f_des)  # multiply by mass in the outer loop\n    return R_des, thrust\n```\n\n**Decision rule:** use small-angle roll\u002Fpitch inverse kinematics only when you can bound tilts to be tiny *and* the thrust computation is derived from the same approximation; otherwise, use the geometric construction above.\n\n## Attitude Controller\n\n### Implementation Logic\n\nPID control on Euler angle errors, scaled by the inertia matrix:\n\n1. Compute angle error: `e = desired_rot − current_rot` (element-wise, 3D vector).\n2. Accumulate integral: `integral_e += e * dt`.\n3. Compute moment: `M = I @ (kp * e + ki * integral_e + kd * (desired_omega − current_omega))`.\n\nUse `make_attitude_integral()` to create a fresh `{\"e\": zeros(3)}` dict before the simulation loop. Never use a mutable default argument for this state.\n\n## Gain Tuning\nNo 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.\n\n## Critical Design Rules\n\n- **Keep thrust and tilt consistent.** If lateral acceleration is commanded, the vehicle must tilt; therefore thrust magnitude must increase so its vertical component still supports gravity while its horizontal component tracks the command. A common consistent form is `F = m * ||a_cmd + g e3||` with attitude derived from the same vector.\n- **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.\n- **Ki should be small** (≤ 0.5 for attitude) — attitude integral wind-up causes x\u002Fy oscillations during z-only maneuvers.\n- `dt = 1.0 \u002F params['sample_rate']` — never hardcode `0.005`.\n- Gains are arrays `[phi, theta, psi]`; multiply element-wise, not matrix multiply, before the inertia `@`.\n\n## Tuning Guidelines\n\n| Symptom | Fix |\n|---|---|\n| Slow roll\u002Fpitch correction | Increase `kp_att[0]` or `kp_att[1]` |\n| Roll\u002Fpitch oscillates | Increase `kd_att[0]` or `kd_att[1]` |\n| Yaw drifts slowly | Increase `ki_att[2]` |\n| x\u002Fy oscillation during hover | Decrease `ki_att` |\n\n## Integration in Main Loop\n\n```python\natt_integral = make_attitude_integral()   # once before the loop\n\nfor iter_ in range(max_iter - 1):\n    ...\n    desired_state.rot, desired_state.omega = attitude_planner(desired_state, params)\n    M = attitude_controller(current_state, desired_state, params, att_integral)\n```\n",{},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FSkillGrad\u002Fmain31_clean_20261004_finalized\u002Ftasks\u002Fdrone-planning-control\u002Frepaired_skill\u002Fattitude-controller-planner",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill attitude-controller-planner",{"tool":36,"command":37},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill attitude-controller-planner",{"tool":39,"command":40},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill attitude-controller-planner","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_clean_20261004_finalized\u002Ftasks\u002Fdrone-planning-control\u002Frepaired_skill\u002Fattitude-controller-planner\u002FSKILL.md",true,[],[45,52,59,66,71,76],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":67,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":72,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":77,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]