I know PID’s have calculus in them, but where else can calculus be found in robotics? I have a student in AP Calc this year who wants to know how he can use it in FRC/FTC! Thanks!

As a student that learns better by being able to connect, im interested too

Pretty much everywhere in physics. Calculating moment of inertia comes to mind as an example.

Calculus is a fundamental engineering topic, it’s not like there’s a single place that it’s “used” but that everything is based on it. When you do the physics to determine how a system will move, you either use calculus or kinematic equations derived via calculus. When you write a control loop to make the system behave how you want it to, you use calculus to invert the physics.

Isaac Newton invented calculus to describe the physics he was quantifying- it’s not just an application of a mathematical concept, it is the description of the physical world in mathematical notation.

Having the ability to describe and analyze a system mathematically is an incredibly helpful skill that I can’t describe exactly where you could use, because it gives you an understanding that’s helpful everywhere even if you’re not doing integrals and derivatives on paper.

How to tell if you have a first/second-year engineering student in the area: They’re spewing profanity directed at some combination of Calc 1 (differentials), Calc 2 (integrals), Calc 3 (doing 1 and 2 in 3D), and (especially) Differential Equations (uh… do 1 and 2, but with equations as the variables).

That’s right. It’s SO fundamental that you have to do 4 different classes to learn enough to use the rest of the stuff you learn in engineering school. And the best part is that once you’ve used this fundamental stuff to derive the equations you need, you can forget about it until you need to derive another equation. But… you do need to know how to derive the equations.

If it moves, calculus can be applied.

One of my personal favorite applications of calculus in FRC design occurred in the 2011 endgame, when many matches were decided based on split-second differences in mini-bot deployment times.

To get the mini-bot climbing the pole quickly, several top-tier teams developed up-curved launching ramps that redirected motion from horizontal on the deployment arm, to vertical on the climbing pole.

Way back in 1696, the French mathematician Jacob Bernoulli (yes, that one) posed the problem of finding the shape of such a launch curve that would get the object from point A to point B quickest – the solution is called the *brachistochrone*, from Greek for “shortest time”. Top mathematicians of the era all submitted solutions. Whose was the best? Some guy over in England who had invented calculus several years earlier, by the name of Newton.

That problem launched a new field of math called Calculus of Variations, which, like the simpler calculus that Newton invented, remains very useful more than three hundred years later.

The ideal shape of a mini-bot launcher is that same brachistochrone, otherwise known as a cycloid curve.

If you’re looking for more specific examples of calculus applications, one of my favorites is minimization. That is, taking the derivative of a function with respect to some variable and setting the expression to zero to find the value of the variable that minimizes the function. This can be used to find the optimal feedback gains for your PID controller, or for optimal model-based filtering (Kalman filters).

I don’t want to go off into the weeds here with derivations, so I’ll just try to describe the general problem each is trying to solve, then link to other stuff for more information.

**LQR**

Let’s assume we have a set of differential equations of the form \frac{dx}{dt} = Ax + Bu where x is a vector of states like position or velocity and u is a vector of inputs like voltage. This equation tells us how the state changes over time for a given input. For a flywheel, B maps the voltage to an angular acceleration, and A represents the back-EMF that works to slow the flywheel down. When these forces are balanced, the flywheel reaches a steady-state angular velocity.

Let’s say we have a proportional controller of the form u = K(r - x). We want to find the gain K that minimizes a weighted sum of the error and actuation effort squared over time.

J = \int_0^\infty \left(x^T Q x + u^T R u \right) \,dt

x^T x is how we do sum of squares for the entries of a column vector. The matrices Q and R (usually) contain weights along the diagonal that reflect how much we care about each state or input deviating from zero.

This controller is called the Linear-Quadratic Regulator because it’s a controller for a linear system that minimizes a quadratic cost function. How to actually find K is rather involved, but it boils down to taking the derivation of a version of J with respect to u, setting it to zero, then solving for u. There’s extra stuff similar to Lagrange multipliers tacked on to ensure the solution obeys the system dynamics \frac{dx}{dt} = Ax + Bu.

**Kalman filter**

For optimal filtering, we also have a system of the form \frac{dx}{dt} = Ax + Bu, but we don’t know x directly because the model is inaccurate. The goal is to steer our estimate of the state \hat{x} toward the true state x using noisy measurements of the form y = Cx + Du. We do this by adding on K(y - \hat{y}), which is a weighting factor times the difference between the actual measurement and what the measurement should have been based on our state estimate. A Kalman filter uses the value of K that minimizes the uncertainty in the state estimate (this uncertainty is quantified as variance, if you know statistics).

Here’s an approachable book on that.

**Miscellaneous reading**

WPILib will have implementations of LQRs and Kalman filters for teams to play with for 2021, as well as factory methods to generate common models (drivetrains, flywheels, single-jointed arms, and elevators). We’ll also have wrappers around the estimation stuff to make optimal estimation using computer vision data easier (not merged yet; still squashing bugs).

If you’re more curious, I’m not claiming this is the easiest intro for model-based control, but it’ll at least give you stuff to Google in a sensible order: https://tavsys.net/controls-in-frc.

More advanced drivetrain and mechanism calculators (like @ThaddeusMaximus’s here) use calculus to predict/model the behavior of systems over time, as opposed to “average” speeds and whatnot. It may be a bit intimidating, but he even has his derivations public if you want to see the math for yourself.

I remember in college that when introducing a new subject of mechanical engineering, electrical engineering, physics, sometimes chemistry, the class started with a derivation that used calculus and ended up with an equation like V=IR, F=ma, PV=nRT.

From “Calculus” wiki

Physics makes particular use of calculus; all concepts in classical mechanics and electromagnetism are related through calculus. The mass of an object of known density, the moment of inertia of objects, as well as the total energy of an object within a conservative field can be found by the use of calculus. An example of the use of calculus in mechanics is Newton’s second law of motion: historically stated it expressly uses the term “change of motion” which implies the derivative saying The change of momentum of a body is equal to the resultant force acting on the body and is in the same direction. Commonly expressed today as Force = Mass × acceleration, it implies differential calculus because acceleration is the time derivative of velocity or second time derivative of trajectory or spatial position. Starting from knowing how an object is accelerating, we use calculus to derive its path.

As you dig deeper into “do the math” in engineering, you’ll find calculus.

Leibniz shares the credit. Archimedes got asymptotically close.

If it “changes”.

Also used for looping rollercoasters.

The first looping coaster caused whiplash:

*"Flip Flap Railway*

*Are you daring - or, perhaps, crazy - enough to ride the Loop the Loop? The first looping roller coaster was Lina Beecher’s infamous Flip Flap Railway , installed at Sea Lion Park. Riding the Flip Flap Railway was a bit of a death wish because it used a perfectly circular loop."*

The best book I read last year:

Infinite Powers by Steven Strogatz

Changed and calibrated my understanding of calculus.

Had to read it like Tapas. Just a chapter at a time so I could digest what I learned.

Another interesting book that is more general is Clockwork Universe. It is the story of how and why calculus (and The Royal Society) were created. After reading it, it was incredibly clear that as @dydx said, calculus is the language of physics.

Quite often. If you describe a combination of arms (linkages) it often pays to calculate where the Max force happens or if you want to calculate the average power needed to do something. The first is to find out what kinda motor you need to drive it or how you have to gear it and the 2nd is to calculate/estimate as to how much power it will draw to see if your battery will “survive” this. In a simple case its something where an arm moves 120 deg under load so you need to calc the average of all sines from 0 to 120 deg. lets say and multiply that with the max torque assuming the max torke happens at 0 deg or how is it different if the max torque happens at 30 deg. etc. Those kinda things happen quite often and it beats figuring this out first instead of slapping somthing on a CIM motor and see if it “lives”

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.