|
1 | 1 | ---
|
2 | 2 | layout: "@layouts/BlogPost.astro"
|
3 | 3 | title: A Path to Squared Inputs
|
4 |
| -description: A short story about bad assumptions and holonomic polynomial input mapping |
| 4 | +description: A short story about bad assumptions and polynomial input mapping for swerve drive |
5 | 5 | categories: [frc, math, robotics]
|
6 | 6 | author: Zynh Ludwig
|
7 | 7 | pubDate: Mar 14, 2024
|
8 | 8 | draft: true
|
9 | 9 | ---
|
| 10 | + |
| 11 | +```html |
| 12 | +<!-- TODO: Intro + Framing device --> |
| 13 | +``` |
| 14 | + |
| 15 | +### Hey programmer, the robot is hard to control |
| 16 | + |
| 17 | +Complaint where the linear input maps poorly with |
| 18 | +the dc motor curves |
| 19 | + |
| 20 | +#### The DC Motor Equations |
| 21 | + |
| 22 | +Show on the Rev Neo data sheet how due to how DC motors work (DC Motor equations?), |
| 23 | +the majority of your robots power output exists in the center of your range |
| 24 | + |
| 25 | +```html |
| 26 | +<!-- TODO: Show Rev Neo power curves --> |
| 27 | +``` |
| 28 | + |
| 29 | +#### What do I mean by Input mapping? |
| 30 | + |
| 31 | +explain with a piecewise function how we could allow for finer control in our optimal |
| 32 | +power range, and lead into the `f(x) = x^2` function as a quick and simple map that |
| 33 | +gives reasonable control in the low to mid range, with sacrifice granularity in the upper range |
| 34 | +of inputs |
| 35 | + |
| 36 | +#### Basic robust squared inputs for diff drive |
| 37 | + |
| 38 | +Show the most basic implementation of a squared inputs in the context of a WPILib DifferentialDrive, |
| 39 | +then compare to the actual DifferentialDrive implementation in WPILibj |
| 40 | + |
| 41 | +```html |
| 42 | +<!-- TODO: Visualize diff drive squared inputs --> |
| 43 | +``` |
| 44 | + |
| 45 | +### And then there was swerve |
| 46 | + |
| 47 | +As frc has evolved, so have our drive systems. Modern frc has settled largely |
| 48 | +on two predominant platforms, skid steer/WCD, and Swerve drive thanks to the advent |
| 49 | +of COTS swerve modules |
| 50 | + |
| 51 | +#### Our new Axis! |
| 52 | + |
| 53 | +Talk about the 3 input axis necessary for controlling a swerve drive, and what that looks |
| 54 | +like on a gamepad |
| 55 | + |
| 56 | +```html |
| 57 | +<!-- TODO: Visualize 3 axis control on a gamepad --> |
| 58 | +``` |
| 59 | + |
| 60 | +#### Don't forget about our dearest squared inputs |
| 61 | + |
| 62 | +Walk brazenly into the naive squared swerve inputs |
| 63 | + |
| 64 | +### The problem |
| 65 | + |
| 66 | +explaining the symptoms, namely the inconsistent drive speed |
| 67 | + |
| 68 | +#### ? Debugging steps |
| 69 | + |
| 70 | +Walk through the joystick circle test we performed at comp, and why that means |
| 71 | +need to review what our previous implementation actually does |
| 72 | + |
| 73 | +### What does our implementation actually do? |
| 74 | + |
| 75 | +We sorta didn't verify that our naive implementation does |
| 76 | +what we expect it to do, so let's visualize it |
| 77 | + |
| 78 | +```html |
| 79 | +<!-- TODO: Visualize the naive implementation --> |
| 80 | +``` |
| 81 | + |
| 82 | +#### What did we want it to do? |
| 83 | + |
| 84 | +Talk about maintaining the vector's angle, but scale its magnitude |
| 85 | + |
| 86 | +#### The literal math approach |
| 87 | + |
| 88 | +- Cartesion -> Polar |
| 89 | + - Potentially a subheading about atan2, a programming thing that math people |
| 90 | + may not know about |
| 91 | +- Scale magnitude |
| 92 | +- Polar -> Cartesion |
| 93 | + |
| 94 | +I need to research (read: ask on math sub) if there is a more computationally |
| 95 | +effecient method of achieving this |
| 96 | + |
| 97 | +I'd really hate for this to be the final result of this write up |
| 98 | + |
| 99 | +talk about its computation costs and maybe other drawbacks |
| 100 | + |
| 101 | +```html |
| 102 | +<!-- TODO: paper conclusion --> |
| 103 | +``` |
0 commit comments