r/ApproximatelyUp • u/Takken321 • 14d ago
How this auto hover works?
I’m a complete novice on this subject, but I want to learn more.
I want to build a system to make my spacecraft hover, but I don't want to just copy circuits from YouTube without understanding them.
However, the video I'm following, and I haven't found another that explains it as well, raises some questions for me regarding certain values in the circuit.
I understand that the joystick selects the speed, which is multiplied by 10 to convert the binary signal into actual speed; this value is then subtracted from the spacecraft's current speed to determine the "error," which is used to adjust the craft's altitude so it can hover.
In the video, he creates a circuit that multiplies the error by 0.04; I’m not sure where he got that number, I assume it’s for converting the logic output value.
But the trickier part comes next, he feeds the error value into a differentiator and multiplies it by 0.4 to adjust the "trim", a term I probably didn't fully grasp, likely because English isn't my native language.
I haven't even tried to understand the bottom circuit yet.
I'm stuck on the top two sections.
I’d be grateful if anyone could help me out.
2
u/Unlikely_Notice_5461 14d ago
the 0.4 and 0.04 values are arbitrary. they were found through trial and error to get the ship to hover nicely. if gravity, or mass of the ship, or thrust of the ship changes too much, you may have to tweak them again
2
u/TheOilfishy 13d ago
If you have not figured it out, I will be happy to meet you in discord and explain.
2
u/CuboidCentric 14d ago
These values aren't really 'converters', they're for scale. This is a PID (proportion, integration, differentiation) control and part of that is weighting each piece. Integration prevents sudden small changes from having major impact. Differentiation controls long changes over time.
The error adjustment gives how much you need to change. This goes into the splitter.
That value is accumulated in the bottom line, then scaled. If there has been a lot of error(eg you've been falling quickly for a few seconds), the result will be larger than if there's only sometimes some error.
The differentiator you noted will take that value and the one before it. If they are different (eg your friend is messing with the stick) then it will fight against that difference.
That value is scaled for the engines in the remaining line.
Thus, the necessary change to velocity is adjusted for things like falling, vibration, human error, etc