← All tools

Gravity Feedforward

The constant that holds an arm up on its own, so the PID only has to correct what is unpredictable.

Inputs

The arm

lb
in
lb
in

The drive

If you have measured it

%

Raise the output until the arm stops falling. Leave at 0 if you have not measured it.

%

The gap between these two is friction, and it is worth knowing.

Results

Feedforward constant, kG

—% of full output

As a voltage

—V

As an 8-bit command

—of 127

As millivolts

—mV

Torque to hold, arm level

—lb·in

Torque at full output

—lb·in

Command at the angle below

—%

Friction, from your measurements

—% of output

Measured holding commandmeasured

—%

A measured hold that is lower than computed is friction helping. Much higher and one of the weights is wrong.

Feedforward through the sweep

Feedforward through the sweep
0°

The bar shows what feedforward alone commands at this angle. It is largest with the arm level, where gravity has the most leverage, and falls to nothing straight up or straight down.

Show the numbers behind this chart

The feedforward command at each angle, which is the table you would put in code if you preferred a lookup to a cosine.

How this is calculated

A PID controller works by being wrong first. It waits for error to build, then reacts to it. That is the right way to handle things you could not have known about: a game object landing in the intake, a partner robot shoving you.

Gravity is not one of those things. If you know the arm's angle, you know exactly what gravity is doing to it, and you knew it before the error existed. Holding an arm up with the P term means choosing to be surprised by the same entirely predictable force, several hundred times a second.

command = kG × cos(angle)

Add that to the loop's output and the arm holds itself at any angle. The PID is then left with only what is unpredictable, which is a much smaller job and a far easier one to tune.

Why cosine

Torque is force times the perpendicular distance to the pivot. With the arm level the whole of its length is perpendicular to gravity, so the leverage is at its maximum. Straight up or straight down the weight pulls along the arm rather than across it, and the torque is zero. A vertical arm needs no holding at all.

Why the command scales with torque

At zero speed a motor's torque is proportional to the current through it, and current is proportional to the voltage you command. So a stationary arm needing a third of the motor's stall torque needs a third of full output, and the constant is just a ratio.

This is only true while the arm is holding still. Once it moves, back-EMF enters and the relationship changes, which is what the velocity feedforward term is for, and a separate constant.

Measure it if you can

The computed figure depends on weights you estimated and a gear ratio you hopefully got right. The measured one depends on nothing but the arm. Raise the output slowly until the arm stops falling: that command is kG, directly.

If measured and computed disagree by a lot, the interesting question is which. A measured value well below computed usually means friction is holding some of the weight for you. Well above, and something is heavier than you think, or the gearing is not what you believe it is.

The gap between holding and lifting is friction

Friction resists whichever way the arm is trying to go. Holding still it helps you, so the command that holds is less than gravity alone would need. Starting to rise it opposes you, so that command is more. The difference between the two measurements is twice the friction, and knowing it is worth more than most tuning.

A large gap means a mechanism that will behave differently going up than coming down, and no single feedforward constant will suit both.

Code for these numbers

Only the numbers come from this page. How your program uses them is up to you, so read each line before you paste it.

Make a notebook page

Turns this calculation into a dated engineering notebook page: the setup, data, results, figures, working and sources, numbered and cited. You add the goal, the decision and the reflection in your own words, plus photos and sketches. Print it, paste it into Google Docs, or download a Word file or slides.

My notebook

Notebook page

More
Open My notebook

    This page

    Our own layouts

    A layout remembers how a page is set up: its type, its system, which parts print and which of your tables it uses. It never remembers a word, a number or a photo.

    Your team kept on this device
    Add someone to the team list
    Your words never written for you

    These are the parts a judge or teacher reads to see your thinking, so the page leaves them to you. Leave a box empty to get lined space for writing by hand. Start lines with "- " for a list. The notes under each box only count and point things out; they never change what you wrote.

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    Rough notes

    The word counts can be measured against a target your team sets on My notebook. The reading level is Flesch-Kincaid grade level = 0.39 × (words ÷ sentences) + 11.8 × (syllables ÷ words) − 15.59. Syllables are counted by vowel groups, so the grade is an estimate of the school year the writing reads at. It says nothing about whether the writing is any good.

    One part at a time, with a clock. At the end of practice, while you remember it.
    How you tested your details

    Fill in what applies. These print as a small table under the method.

    Before and after

    Compare this calculation with a run you saved earlier on this tool (under “Saved runs”). The page shows what changed and by how much.

    A line through the data from your recorded table

    Pick two measured columns from the same table. The page plots them and draws the least-squares line, only across the range you measured.

    Robot log a CSV from the robot's SD card

    Load a CSV your robot saved. Pick the time column and up to three columns to plot, and type their units. Only those columns go on the page; the file stays on this device.

    Two versions' trials your data, compared

    Pick a column of recorded trials for each version, from this page or another saved page. The page shows both averages and a 95% range for the difference. The numbers are copied in when you pick them, so later changes to the other page don't change this one.

    Options compared your scores

    Score each option 1 to 5 on each criterion, and weight each criterion 1 to 5 by how much it matters. The page only multiplies and adds.

    Photos and sketches stay on this device

    Up to 4. Paste a screenshot with Ctrl+V, drop pictures here, or pick them. Photos are shrunk before they’re kept, and an unsaved page keeps them in its draft. Use Mark up to draw arrows, labels, dimensions and numbered callouts on a photo. Mark one photo Before and one After to print them side by side.

      Test plan written before testing

      Write this before you test: the question, what you expect with a number, and what result would make you drop the idea.

        Build steps our build

        One row per step, in order, so someone could rebuild from this page.

          Parts used our parts list

          Lengths in holes are also shown in inches between the end holes. Weights are only added up where you type them.

            Plan the cuts: packs every piece of one part (sizes in holes, or inches on the hole grid) onto whole sticks of the stock length you type.

            Ways it could fail our scores

            List the ways this could fail. Score how likely (1 to 5) and how bad (1 to 5); the page multiplies them and puts the biggest risks first.

              Designed against built our measurements

              What the CAD or the plan said, and what you measured on the robot. The tolerance is yours.

                Changes from the last version our changes

                What changed since the last version, why, and which result it was meant to move.

                  That page’s settings, results and first photo are copied in and set beside this page’s. The result each change should move is looked up on both pages.

                  Tasks our plan

                  What needs doing, who, and by when. Open tasks carry to the next meeting page until someone ticks them done.

                    The pages behind this idea our evidence

                    The pages in this notebook that show the idea being tried, measured or changed. A judge reading the claim can turn straight to them.

                      Time spent our hours

                      Who worked on this and for how long.

                        Session log what we did, as we did it

                        Notes taken during a session. The time comes from the clock when the note was taken; every word is yours.

                          Size limit does it fit?

                          Type the starting size limit from the current game manual, and the robot's size as designed or measured, in inches. The site doesn't store the limit, because it changes with the game.

                          What broke from your breakage log

                          The breakage log is on My notebook. Copy it onto this page as a table, as it stands now; later entries don't change this page.

                          CAD model which version this page is about

                          Paste a link to the model (Onshape, Fusion or anything else) and the name you use for this version. For Onshape, the page reads from the link whether it points at a saved version or a workspace that keeps changing. Nothing is fetched.

                          Your code
                          Comments notes for the team, not the page

                          A teammate or coach can leave a note here. Comments stay beside the page, travel with it in exports and links, and don't print unless you tick them under Include.

                            Sources you used besides this tool

                            Videos, other teams, manuals, people. The tool’s own sources are cited for you.

                              Sign-off
                              Include

                              Press a ? to see what an option is for, or read them all on How the notebook tools work.

                              What “The calculator’s figures” is for

                              The calculator’s own diagrams and charts, numbered as figures and drawn from your numbers. Judges look for pictures that explain a design.

                              What “How it was calculated” is for

                              The formulas and steps the calculator used, so a reader can check the arithmetic for themselves.

                              What “The calculator’s warnings” is for

                              Things the calculator flagged, such as a motor near stall. They’re quoted and credited to the calculator, so they never read as your conclusion.

                              What “The calculator’s notes” is for

                              The calculator’s plain-language notes on the result. Off at first, because they read like conclusions, and the conclusions on a page should be yours.

                              What “Lined space” is for

                              Ruled lines under any part you haven’t written yet, so a printed page can be finished by hand.

                              What “Writing space as” is for

                              The blank space for handwriting as ruled lines, a dot grid or quarter-inch squares. Dots and squares suit sketches and hand-drawn graphs.

                              What “A summary under recorded data” is for

                              The number of readings, the average, the spread, the lowest and the highest under each table you recorded, worked out from your numbers. It shows every run counted, not just the best one.

                              What “Words used” is for

                              A small box with the site’s one-line definitions of glossary terms the calculator used, for readers who don’t know them. It never looks at your own writing.

                              What “Robot at the time” is for

                              The Robot Profile as it was when the page was first saved, so weeks later you can tell which version of the robot a test was run on.

                              What “Long tables in full” is for

                              Long calculated tables printed complete on an extra page, instead of every few rows on the page itself.

                              What “Fit on one sheet” is for

                              Smaller type and shorter tables, aiming for one printed sheet. Use it when every entry in your notebook should be a single page.

                              What “Wider left margin” is for

                              A wider left edge, so the page can be hole-punched or bound without losing any words.

                              What “Larger type, for reading aloud” is for

                              Bigger print with more room between lines, for the team member who reads the page to a judge. It overrides Fit on one sheet.

                              What “Our rubric scores” is for

                              Your own scores against the rubric, on a sheet of their own, for checking a page before a judge does.

                              What “When this page was first saved” is for

                              The day the page was first saved, printed beside its date. It shows the notebook was kept while the work happened.

                              What “Teammates’ comments” is for

                              Prints the comments teammates left on this page at the end, marked as not part of the page. Off at first, because comments are notes for the team, not for judges.

                              What “Show every table and block” is for

                              Shows every table and block in the editor, not only the ones this type of page usually uses. It changes the editor, not the printed page.

                              Rubric check

                                This checks what is on the page, not how good it is. Clear, specific writing in your own words is what earns the top marks.

                                Preview, letter size

                                Write it now

                                Save this run, and compare

                                Keeps what is on screen so you can change something and see both sides of the change. Saved in this browser only, never uploaded.

                                Sources & assumptions

                                Cartridge stall torques are VEX figures. Everything else is the arm you described.

                                The proportionality between holding torque and commanded voltage is the standard model for a brushed DC motor at zero speed, where back-EMF is zero and current is set by the applied voltage against winding resistance. It is a model: a V5 motor's controller limits current near stall, so a computed constant above roughly 60% should be treated as an estimate and checked on the robot.

                                Every source the site uses, and when it was checked

                                Where the answers on this page can be used, and which tools could have given you the numbers it asks for.

                                a number carries across the next question it raises

                                Keyboard shortcuts

                                Anywhere

                                Ctrl K or /
                                Search
                                T
                                Switch color theme
                                B
                                Bigger text, for a projector
                                F
                                Readable font, on or off
                                ?
                                This list

                                On a tool

                                S
                                Star or unstar it
                                C
                                Copy the results
                                L
                                Copy a link to these exact numbers
                                P
                                Print or save as PDF

                                Letter keys do nothing while you're typing in a box.