Readit News logoReadit News
bandrami · 2 years ago
My control systems prof said every engineer has done an inverted pendulum problem in school and nobody in their career has ever been asked to balance an inverted pendulum. So our final was a thermostat instead.
goku12 · 2 years ago
An unstable rocket (almost all of the big ones) is an inverted pendulum of sorts. The combined center of thrust and aerodynamic forces is usually below the C.G, and the rocket tends to tip over if not actively stabilized. To add a little, a slight margin of tipping is allowed, but the rocket tends to break up if the angle of attack crosses certain limit at high speeds.
regularfry · 2 years ago
Liquid fuel rockets complicate matters: think "inverted pendulum with a couple of stacked, full wine glasses that you absolutely must not spill balanced on top. Oh, and there's a gremlin drinking from them so both CG and total mass are constantly moving."
e-_pusher · 2 years ago
Some engineers do balance inverted pendulums in their careers! https://space.stackexchange.com/questions/15486/how-does-the...
tnecniv · 2 years ago
Clearly your professor hasn’t had to stand upright in his career or walk for that matter.

The (spring loaded) inverted pendulum was one of the earliest analyzed models of legged locomotion.

FirmwareBurner · 2 years ago
Yeah, his professor wasn't too bright if he said that. He probably never heard of Segway, One-Wheel, "hoverboards", or motorcycles with stability control.
nullc · 2 years ago
> nobody in their career has ever been asked to balance an inverted pendulum

Thats what all those self-balancing scooters are.

bandrami · 2 years ago
That's how long ago this was
TeMPOraL · 2 years ago
Unfortunately, they remain a rare sight.
phkahler · 2 years ago
And the stair climbing wheelchair.
jcarrano · 2 years ago
Holding a fixed position on a double integrator system (like a hovering drone) in discrete time is a nice problem too.
RhysU · 2 years ago
Possibly useful: A header-only proportional-integral-derivative (PID) controller.

https://github.com/RhysU/helm

stefan_ · 2 years ago
It's a nice theoretical implementation but few practical examples would be found using floating-point math, running as they are on systems that don't support it.
cellularmitosis · 2 years ago
I find this hard to believe. Even a humble arduino can do 34,000 software float divides per second. https://gist.github.com/cellularmitosis/506c878631f806cfe6f8...
galangalalgol · 2 years ago
Is this still true? It seems like most IoT stuff has chips that easily eclipse the capabilities of my Amiga1000 and are 32bitbwith hardware floats. Looking around, I'm having trouble finding something that isn't a 32bitHF in my house. Possibly my Keurig machine? Even using digital instead of an RLC implementation in a coffee machine seems like a waste, but I'm old.
Espressosaurus · 2 years ago
I've had about as many floating point PID implementations running on the attached core of an embedded ASIC as I have fixed point implementations (running fully within the hardware).

Both are useful.

Philpax · 2 years ago
Not all PID controllers are destined for embedded. They’re quite useful in gamedev, for example.
nullc · 2 years ago
Even where the hardware is available, it can be harder to prove properties about the behavior of the floating point versions. It's no fun when everything turns to NaNs because of surprise cancellation in subtraction.
the__alchemist · 2 years ago
Cortex-M4s/M7s/ESP32s/Nordics are cheap and ubiquitous. They all have hardware floats. M0s are available fast enough to do soft floats.
sgtnoodle · 2 years ago
Maybe that was true up until the 90's, but doing anything but floating point for a PID is just a waste of development time, even on an 8-bit AVR.
junon · 2 years ago
This isn't true at all. We use them in scientific firmware all the time. Arduinos, pis, cortexes, you name it.
nebster · 2 years ago
The "Ball on Platform: Edge Balance" one seems super interesting to me.

Is the sample solution just hardcoded or is there some maths behind it to make it work from any location/initial speed?

hddqsb · 2 years ago
It's robust. I hamstrung the model solution by forcing pistonAcceleration to be 0, and forcing hingeAcceleration to be 0 during the first second, but it still "caught" and balanced the ball.
function_seven · 2 years ago
I'm still on the first level playing with various 'P's and 'D's (no 'I's yet), but I think I have a novel scheme!

    function controlFunction(block)
    {
      let L = Math.floor;
      let x = block.x;

      // Use Collatz. L(x+½) is the closest integer. 
      return 
        -(L(x+0.5) % 2 === 0
                        ? x/2     // Even, we chop it
                        : 3*x + 1 // Odd, we triple-plus-one it. 
         );
    }
It's not very good, but it does beat or tie some of my earnest attempts to get below 8 seconds.

Deleted Comment

01100011 · 2 years ago
Some sort of 'high score' would be nice so I can understand how close my solution is to the ideal.

Pretty neat website overall. Seems like I'll be wasting some time on it.

kavouras · 2 years ago
The ideal solution, given that there is not input limit, depends on the simulation accuracy. Theoretically, you could achieve 0 time solutions.
fisherjeff · 2 years ago
Ugh, nerd sniped on a Sunday. Great.
jstanley · 2 years ago
This is brilliant, what a good idea.

On the "Cruise Control Intro" challenge it's not made clear what the output of the controlFunction is. Am I returning a throttle position? A delta to the throttle position? Something else?

I didn't have any trouble until I got to "Ball on Platform: Balance" which seems to be multiple steps more difficult than the previous ones.

bArray · 2 years ago
I think the variable limits are not always made clear. The objective is only really accessible on that first menu, otherwise you cannot re-check it. Errors in the console are mostly squashed and don't give important details like line numbers.

Don't get me wrong, I think this is really awesome! We are only talking about a few UI improvements to what is already an excellent resource.

lqr · 2 years ago
If the author is here: I would really enjoy leaderboards!
NooneAtAll3 · 2 years ago
best solutions will be "Insane value to instantly teleport to the point. Insane anti-value to instantly stop."
v9v · 2 years ago
I think what you are suggesting is similar to the "dead-beat controller" in discrete-time control literature. While a controller designed with this method can get the position error measured at the sampling times to zero very quickly, it gives no guarantees that the error stays zero between the samples. This means the block could be wildly oscillating around the arrow in reality, but oscillating in such a way that it's exactly under the arrow at the times your digital controller measures it.

This would probably not be a concern in this digital simulator, but such an error can pop up when trying the same thing out in real life.

See slide 17 here for a plot: https://www.slideserve.com/sibyl/finite-settling-time-design

nullc · 2 years ago
There appears to be a hidden limit on acceleration forces.