Live data from Hacker News

PID Control Challenges

janismac.github.io

61–70 of 123 posts

Re: PID Control Challenges

#61
post #41
post #37

Earlier quoted context omitted.

Show code or it didn't happen :)

it's pretty trivial! erghea -400 oybpx.k-40 oybpx.qk; (not that rot13 really obscures anything here!) The rest of the puzzles get pretty interesting, I shouldn't have just stopped on the first and spent all the time optimizing it. If the author sees this thread it would be fun if you could disturb the dynamics with the mouse after completing one. I wanna watch the ball catching piston right the ball if I poke it.

If you're one of the lucky 10,000*

echo "V fzvyrq gbb jura V yrnearq nobhg ebg13" | tr 'A-Za-z' 'N-ZA-Mn-za-m'

*: https://xkcd.com/1053/

Re: PID Control Challenges

#62

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.

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.

Re: PID Control Challenges

#63
This is very cool, I like the increasing complexity levels.

I actually made a similar thing based on writing your own autopilot for a Lunar Lander [1]. It's hard to make the difficulty increase linearly though. I like the use of different scenarios in this one.

[1] https://lunar.unnecessarymodification.com/

Re: PID Control Challenges

#64
post #11

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?

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.

Re: PID Control Challenges

#66

I cheated on level one and entered: function controlFunction(block) { let x = 5; if (block.dx > 0) { x = block.dx; } if (block.T > 1.75) { return 0; } return 2 * x; }

Why is that cheating? But it is still very slow, I got it down to 0.42 seconds.

  function controlFunction(block)
  {
    const t = Math.round(block.T / 0.02);

    return (t 
Misses the target by 6.1E-16 at an velocity of 6.3E-15. But yes, this should probably randomize the initial conditions or parameters like friction and gravity a bit so that you actually have to control the system.

Re: PID Control Challenges

#67
post #58

Earlier quoted context omitted.

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."

True. Liquids make control difficult. > full wine glasses that you absolutely must not spill balanced I'm not sure what you mean by spilling. The liquids are usually contained in fully closed tanks and cannot spill. The thrust usually keeps the liquid at the bottom around the engine intakes. However, liquid sloshing inside the tanks is a problem. Even with slosh dampers, sloshing liquid manages to create attitude dis…

I think they also don't actually use wine, gremlins or any glass containers...

Re: PID Control Challenges

#68
post #27
post #7

Earlier quoted context omitted.

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.

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.

Check every division.

Re: PID Control Challenges

#69
post #58

Earlier quoted context omitted.

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."

True. Liquids make control difficult. > full wine glasses that you absolutely must not spill balanced I'm not sure what you mean by spilling. The liquids are usually contained in fully closed tanks and cannot spill. The thrust usually keeps the liquid at the bottom around the engine intakes. However, liquid sloshing inside the tanks is a problem. Even with slosh dampers, sloshing liquid manages to create attitude dis…

My inner child of Doc Brown and Wernher von Kerman says, it's time to develop non-newtonian fuel sponges, which would release fuel if squeezed gently and steadily, but behave like solid if things start shaking too much, preventing sloshing.

Re: PID Control Challenges

#70
post #26

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.

> nobody in their career has ever been asked to balance an inverted pendulum Thats what all those self-balancing scooters are.

Unfortunately, they remain a rare sight.
Post reply on HN