From b657c647bbb54e6d874afb1a0467b7f6a5e9016d Mon Sep 17 00:00:00 2001 From: Jade Turner Date: Tue, 17 Jun 2025 10:41:38 +0800 Subject: [PATCH 1/2] Add some notes on gains Signed-off-by: Jade Turner --- astro.config.mjs | 4 ++++ src/content/docs/controls/gains.md | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/content/docs/controls/gains.md diff --git a/astro.config.mjs b/astro.config.mjs index e5e8235..7356155 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -18,6 +18,10 @@ export default defineConfig({ label: '4788 Documentation', autogenerate: { directory: '4788' }, }, + { + label: 'Controls', + autogenerate: { directory: 'controls' }, + }, { label: 'External Docs', items: [ diff --git a/src/content/docs/controls/gains.md b/src/content/docs/controls/gains.md new file mode 100644 index 0000000..2b02084 --- /dev/null +++ b/src/content/docs/controls/gains.md @@ -0,0 +1,12 @@ +--- +title: Gains +--- + +Some notes on common gain types for FRC mechanisms: + +- We can find KV for a mechanism from max speed / max output +- We can find KA for a mechanism from max output \* mass \* radius / stall torque +- You can find PD gains for a system from KV and KA using LQR as done [here](https://github.com/CurtinFRC/2025-Reefscape/blob/97b38f60e3f359b29868ac4a912493ae2ca4138e/src/main/java/org/curtinfrc/frc2025/util/FeedbackAnalysis.java) +- KS is the amount of voltage before the amount required to make a mechanism move +- KS and KG can be found for an elevator or arm using KG = (output up + output down) / 2 and KS = (output up - output down) / 2 where output up and down are the voltage needed to move the mechanism up or down. Note also for arms this will require some use of trig if the arm cannot start flat +- note all of these ignore mechanism gear ratios From a138c02198a2e533351d3d3bfbd4eaa49886447f Mon Sep 17 00:00:00 2001 From: Jade Turner Date: Tue, 17 Jun 2025 21:25:49 +0800 Subject: [PATCH 2/2] Add tuning articles Signed-off-by: Jade Turner --- src/content/docs/controls/gains.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/content/docs/controls/gains.md b/src/content/docs/controls/gains.md index 2b02084..169cd2b 100644 --- a/src/content/docs/controls/gains.md +++ b/src/content/docs/controls/gains.md @@ -10,3 +10,9 @@ Some notes on common gain types for FRC mechanisms: - KS is the amount of voltage before the amount required to make a mechanism move - KS and KG can be found for an elevator or arm using KG = (output up + output down) / 2 and KS = (output up - output down) / 2 where output up and down are the voltage needed to move the mechanism up or down. Note also for arms this will require some use of trig if the arm cannot start flat - note all of these ignore mechanism gear ratios + +Some more notes on tuning can be found in these articles + +- https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/tutorial-intro.html +- https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/common-control-issues.html#common-control-loop-tuning-issues +- https://v6.docs.ctr-electronics.com/en/stable/docs/api-reference/device-specific/talonfx/closed-loop-requests.html