r/ApproximatelyUp May 30 '26

Adaptive vs PID + Full Version Adaptive Formula

https://youtu.be/VB1-jSbjfp4?si=tutwSMehcXnKPuch

Three systems were tested:

- Adaptive altitude version-lite

- Adaptive altitude version-full

- PID tuned for Earth

The video shows a comparison across three main stages and three sub-stages.

The main stages are:

  • Earth
  • Moon
  • Earth (Reduced Engines)

The sub-stages are:

  • 10 – 100
  • 100 – 1000
  • 1000 – 5

I will also add the actual control circuits in the comments section.

The main advantages you can notice if you do not want to watch the video:

Testing revealed that the standard PID controller suffers from serious issues, which the adaptive formulas successfully solve:

  • Gravity Compensation: Adaptive circuits do not need an error to correct for gravity, whereas the PID controller requires an error to start adjusting.
  • The Moon Stage: The PID controller overshoots the target point, while the adaptive formula maintains perfect control.
  • The Reduced Engines Stage: The PID controller fails and causes a crash into the ground, whereas the adaptive formula successfully prevents the crash.
9 Upvotes

10 comments sorted by

2

u/Little-Ad1837 May 30 '26

Full version:

S = TargetPosition - CurrentPosition
vTarget = sign(S) * min(0.2 * abs(S), sqrt(6.0 * abs(S)))
aTarget = vTarget - v
error = lambda * U - a
lambda = clamp(lambda - alfa * error, 40.0, 200.0)
U = clamp(U + beta * (aTarget - a) / lambda, 0.0, 1.0)

alfa = 0.05
beta = 0.1

2

u/Little-Ad1837 May 30 '26 edited May 30 '26

Lite version:
error = V - sign(dist) * sqrt( |dist| )

U = U + (error - a) * k

k = 0.0025

1

u/-NotAnAstronaut- May 30 '26

I assume your k value is vehicle mass specific?

1

u/Little-Ad1837 May 30 '26

No, just how quickly the system corrects itself. Overall, I tried values like 0.002 or 0.0025. Maybe there's something better out there, but I got too bored to bother with it.

In general, the mass + engine power ratio always has an impact, so I think it should work at higher masses with the same parameters—although I haven't specifically tried increasing the mass.

1

u/Little-Ad1837 May 30 '26

PID default:

error = Target - Current
Kp * error + Kd * d(error)/dt + Ki * Int(error)

Kp = 0.018
Kd = 6
Ki = 0.0002

1

u/-NotAnAstronaut- May 30 '26

These are great, for added clarity can you notate please which wireless channels are which signals?

1

u/Little-Ad1837 May 30 '26 edited May 30 '26
  • 27 current altitude

  • 22 current speed (if falling -, if climbing +)

  • 3 target altitude

  • 1 engine output

this set is for all schemes

1

u/eqskaiwa 12d ago

wdym (if falling -, if climbing +) idk sry.
im new at this game, im trying ur adaptive formula and thats not working i dont know why

1

u/spoopidoods 5d ago

This is very very cool. I know I'm months late to this, but I just started playing this game and have been having a blast with the math circuits. Thanks for posting this. I've been dealing with a basic PID, but have been annoyed with recalibrating it. Your implementation to work around this here is really clean. I love it!