This ch(tr)unk of j(f)unk is an attempt to learn more about PID controllers and how they can be implemented in Vizzy. The technical objective is to achieve zero vertical velocity, i.e. it hovers, for a couple of minutes at least then lands automatically.
In this update I’ve added extra navigational inputs so it can scoot around on just translation controls. Mainly I’ve added some extra stuff to the script which is important.
Translate Up to ascend (maximum positive vertical velocity of 20).
Translate Down to descend (maximum negative vertical velocity of -20).
Translate Forward/Back pitches the craft to build or reduce lateral speed.
Translate Left/Right to change heading.
Change direction with a combination of pitch and heading.
Once fuel runs low a setting down procedure will begin automatically. This can be initiated manually on AG 10.
These AG assignments are there for analytical purposes only. Generally there’s no reason to touch them.
AG 1 to 3 activate gains for respective PID calculation.
The controller bias can be turned off on AG4. It’s not recommended but to see what affect no bias has, be sure to compensate by increasing gains elsewhere.
AG5 switches the data display to show gain values.
Slider 1 tunes gain for the proportional calculation.
Slider 2 tunes gain for the integral calculation.
Technical notes.
Amongst other improvements:
Added a control bias variable to the summed output.
Added a ramp on ascent/descent inputs to combat integral windup.
GENERAL INFO
- Predecessor: Vizzy PID controller test rig BETA
- Created On: iOS
- Game Version: 0.8.402.0
- Price: $618k
- Number of Parts: 105
- Dimensions: 3 m x 4 m x 4 m
PERFORMANCE
- Total Delta V: 2.9km/s
- Total Thrust: 141kN
- Engines: 4
- Wet Mass: 10,393kg
- Dry Mass: 3,057kg
STAGES
Stage | Engines | Delta V | Thrust | Burn | Mass |
---|---|---|---|---|---|
2 | 4 | 2.9km/s | 141kN | 2.1m | 10,393kg |
13 Comments
- Log in to leave a comment
-
-
-
1,155 huuminberd
@crowxe Yeah orbital rendezvous would be a quite an achievement. I'm not sure we could do it without being able to target ascending nodes but that will come. Someone will get there in the end, maybe there should be a automatic prize of a 1000pts to whoever writes a script that achieves a successful rendezvous 100% of the time. Might get that in upvotes though.
-
8,458 crowxe
@huuminberd
I accidentally hit the auto hover thing during my early fails in suicide landing burn (AGL is using center of mass, not landing legs)
I'm interested in control methods and information readings to improve auto docking (currently works like 6 out of 10) and approach for rendezvous which is still not working even a bit. So I'm following and let us know if you made any thing new 👍 -
1,155 huuminberd
Spoiler Alert
The problem of hovering in SR2 can be solved precisely using mathematical modelling. Check out 'Simple hover vizzy program' by pedro16797. There isn't really any point in using a PID controller to do something where there exists such a precise formulaic solution. I chose hover as a target just because it was a straight forward starting point to look at closed loops control systems. What I'm looking at now is a situation where there can be no formulaic solution. Tracking contours. Using the formula for precise zero vertical velocity as a base throttle control and a PID controller to react to changes of AGL. Early days but it's quite satisfying seeing the little craft rise and fall with terrain, climb hills and drop into valleys without any external input. -
1,155 huuminberd
@crowxe It might be something if you could tune autopilot on the fly with Vizzy. Probably a bit niche though. Can't see it as a priority but then again wouldn't be difficult to implement. Hopefully Vizzy will soon provide enough information, such as bearing, to build our own autopilot, I quite like this approach because we could really dig down and configure stuff at a low level. I'm sure things will develop over time. I really want to be able to use look up tables, multidimensional arrays, to start investigating fuzziness. PID has its uses but it's old tech and not much more can done with it. Fuzzy logic control and adaptive neural networks are where the party's at.
-
8,458 crowxe
@huuminberd that's great I played a little with those controls but usually if a craft needs changing those values in the auto pilot in some stage , I'm forced to redesign or reprogram since I can't change those values with vizzy. In a certain programs I wish I could throw away "integral" and stay with the pure "proportional" when I'm aiming to get input reading (when RCS, engines and gyro are turned off locking to a target will return pitch and yaw input values that I use as compensation for not having bearing reading output in vizzy) . And regarding overshooting avoidance I create simple functions for my control like if desired apogee is 36,000 km set throttle to x+ ((36,000-apogee) / 38,000) this was helpful when my apogee is running like crazy and overshoots Luna orbit. I'm on phone for now and can't control active groups to test your craft. Any thoughts?
-
1,155 huuminberd
Urgh Comment got cropped sorry about that. Well that’s basically it anyway. I’m still really learning the basics myself which is why I built this.
-
1,155 huuminberd
@crowxe Say you have a water tank. The temp is 15deg(process) but you want it to be 20deg(Setpoint). You have an error of 5deg, Setpoint minus process. Or the water is 30deg but now you don’t care much however you don’t want it to get colder than 10deg. Here you have an error of -20deg. There’s a heating element and if the error is positive you want it to supply more power and vice versa. You can see how the calculated error could be used to vary the power supplied to the heating element.
Now what if the error was simply scaled up or down and fed directly to the power regulator of the heating element. It reacts on the element PROPORTIONALLY that’s the P part. Problem is it tends to oscillate. Reacting, overshooting, counter-reacting, undershooting. If we turn down the amount of error (the proportional gain or kP) we feed our actuator(the heating element) we can get rid of the oscillation but may not reach our target. In some circumstances it’s good enough but often it needs help. So we try something different and add that onto to our total output. The INTEGRAL part accumulates value over time. Every cycle of the controller where an error exists a little bit gets stuck on or taken off the integral value. If the Proportional doesn’t quite hit the target the integral value will grow and grow until it pushes our control output to a level that drives our actuator to it’s target. Problem is, if the integral has acquired too much value we overshoot. If the error was large and took a long time to correct the integral might be huge. We just keep going and going. This is known as integral windup and there must be strategies to deal with it. Maybe there’s just a little overshoot, we don’t care much, it settles down, doesn’t oscillate excessively, good enough. But we’re still not happy 😭 Now what? We add another trick to our bag of tricks. If we knew how fast our error value was changing maybe we take that and use it to dampen the rate of change, like the suspension in car, kind of. That’s what the DERIVATIVE does. Smooths things out. All we need to do is to hold on to the error value from the previous cycle and we can find the difference over time.
Basically that’s what a PID controller does, I’m no expert, there’s a lot more to it. For instance if we apply it here to a situation where we want to hover, we reach our target velocity, great, no error, oops, no error, no output, throttle drops to zero and down we go. Of course eventually our integral will take the str -
-
1,155 huuminberd
@DROP Thanks but this is beginner level naive fumbling about, it works reasonably well though. There's some Matlab YT videos on an introduction to PID control that have been helpful. Otherwise the best online resource I've found, fanboy alert, this is the good stuff.. https://controlguru.com/table-of-contents/
Subheading "Proven Methods and Best Practices for Automatic PID Control". If anyone is interested. Written for industrial processes but that's here nor there, there's a lot that is applicable. It's well written and not as dry as it sounds. I've barely started to implement some of the ideas in this. Might take a while.. -
will the program work for jets or ions?