Stormworks: Build and Rescue

Stormworks: Build and Rescue

Eagle Apr 6, 2021 @ 9:26pm
PID for Altitude hold on MicroJet
So ive had altitude hold installed my microjet I built and Im getting around to trying to make it work. Well simply put it doesnt.

The jet is very small and compact its also a jet not a prop plane I suspect that because of its size and speed engine power ect the usual PID settings are not working.

Ive watched several guides and read several guides and tried changing the numbers it doesnt work. At first it was just doing alititude dips and raises then a back flip
Then I changed somethign it seemed to back flip less but its still roller coaster dipping and raising and its extreme nose attitude changes.

My Pid setting is P 0.1 I is 0.00001 D is 0.1
I figured because its a smaller plane Id have to use 0.050 on the P didnt work
I read in the comments running the output of the PID to an inverter would solve my issue
it didnt I have the output to an inverter and it still doesnt work.

I dont have to have altitude hold in fact I would rather have pitch hold tbh but I dont see that on the workshop. Only altitude control.

Im still waiting to hear back on the nose wheel steering post I did but for now Im trying to work on the altitude hold since its a pid and is going to take a bit.
< >
Showing 1-15 of 26 comments
Aven Apr 6, 2021 @ 10:35pm 
2
2
Unfortunately no one can really help you tune it. The scale of your numbers will be based on your inputs and outputs, and fine tuning them is a lot of trial and error.

P does your correcting. A lower relative P allows for slower corrections, a higher allows for faster corrections. If your craft is slow to correct, increase P. If it's overcorrecting or correcting too quickly, decrease P.

D adjusts for overcorrections and scales the deceleration as you near the setpoint. D will almost always be a factor greater than your P, i.e. 5x, 10x, or 100x your P value. If your controller is swaying back and forth over the setpoint, increase D. If it's jittery on the setpoint, decrease D.

I is determined last and only if needed. If your P and D collectively can only get you close to your setpoint but not quite there, add in I. This is a cumulative correction that builds over time, and will be a factor much small than your P, i.e. 1/10x, 1/100x, 1/1000x your P value.

Start with a low P value. If you are feeding your PID into 0 to 1 a scale output like throttle, then try a .01 to .1. Set I to 0. Don't adjust I until you have P and D sorted out. Set D to 5x P. Test. If corrections are slow, double P. If your craft sways back and forth over the setpoint, increase D's factor. If it's close but can't quite hit the mark, add an I at 1/100 of P and increase slowly until it feels right. If it is correcting the wrong direction, invert the output from the PID. If it's not doing anything, make sure your PID is connected correctly and turned on.

It can be frustrating, but it's something you really just have to play with until it feels how you want it to feel.
Eagle Apr 6, 2021 @ 10:43pm 
Originally posted by Aven:
Unfortunately no one can really help you tune it. The scale of your numbers will be based on your inputs and outputs, and fine tuning them is a lot of trial and error.

P does your correcting. A lower relative P allows for slower corrections, a higher allows for faster corrections. If your craft is slow to correct, increase P. If it's overcorrecting or correcting too quickly, decrease P.

D adjusts for overcorrections and scales the deceleration as you near the setpoint. D will almost always be a factor greater than your P, i.e. 5x, 10x, or 100x your P value. If your controller is swaying back and forth over the setpoint, increase D. If it's jittery on the setpoint, decrease D.

I is determined last and only if needed. If your P and D collectively can only get you close to your setpoint but not quite there, add in I. This is a cumulative correction that builds over time, and will be a factor much small than your P, i.e. 1/10x, 1/100x, 1/1000x your P value.

Start with a low P value. If you are feeding your PID into 0 to 1 a scale output like throttle, then try a .01 to .1. Set I to 0. Don't adjust I until you have P and D sorted out. Set D to 5x P. Test. If corrections are slow, double P. If your craft sways back and forth over the setpoint, increase D's factor. If it's close but can't quite hit the mark, add an I at 1/100 of P and increase slowly until it feels right. If it is correcting the wrong direction, invert the output from the PID. If it's not doing anything, make sure your PID is connected correctly and turned on.

It can be frustrating, but it's something you really just have to play with until it feels how you want it to feel.

its diving and climbing doing a little shape like you were see on a heart monitor in the hospital squiggles if you will. Noses way up climbs then gets there and nose dives then climbs. I figured half of the 0.1 would be 0.050 but that had almost no difference.
Its about a 1/4th of the standard jets you see in stormworks in length and width. Very small and short. But pretty fast.

Maybe if I use 0.025 and and multiple the D value will get it to behave?
Last edited by Eagle; Apr 6, 2021 @ 10:44pm
pontfogel Apr 6, 2021 @ 11:07pm 
Is it able to fly well in manual mode?

As an option, I normally start tuning only P and leave I and D at 0 until I'm close to where I want to be with P.
Eagle Apr 7, 2021 @ 3:53am 
Originally posted by pontfogel:
Is it able to fly well in manual mode?

As an option, I normally start tuning only P and leave I and D at 0 until I'm close to where I want to be with P.
Yeah the PID is only for the Altitude hold on it.
The C-47 I got from the workshop has pitch hold instead of altitude hold. Im thinking about going after that instead but I dont know.
pontfogel Apr 7, 2021 @ 4:39am 
Originally posted by Eaglezero6205:
Originally posted by pontfogel:
Is it able to fly well in manual mode?

As an option, I normally start tuning only P and leave I and D at 0 until I'm close to where I want to be with P.
Yeah the PID is only for the Altitude hold on it.
The C-47 I got from the workshop has pitch hold instead of altitude hold. Im thinking about going after that instead but I dont know.
I used vertical speed hold on the only plane I built. Speed sensor (vertical) to pid variable, keypad to setpoint. Output to elevators. If I remember correctly. :)
GrumpyOldMan Apr 7, 2021 @ 4:51am 
I always got fast and solid (like on rails solid) results when using altitude hold. Pitch hold and vertical speed hold can yield different results, if you primarily want your plane to stay at a certain altitude it's way easier and more effective (in terms of time spent tuning the PID) to use the difference between target and current altitude with a setpoint of 0.

This way the PID can be quickly dialed in, starting at a rather low P value somewhere around 0.1, depending on your plane, amount of control surfaces etc.

A pitch hold might be not the right tool for the job if all you want is to stay at a desired altitude. A roll hold is usually used at the same time as the altitude hold, to guarantee maximum usage of control surfaces among the correct axis.

Vertical speed hold can lead to issues if you don't nail it 100%, which will result in the plane constantly climbing or sinking at a slow rate.

You can also expand on the altitude hold further and control vertical speed until the desired altitude is within a certain margin. This would also prevent the plane from climbing/sinking at too steep an angle, when using rather aggressive P values.

As others already stated, start with a low P value and don't touch the other variables until P brings you within an ok range of the desired altitude.
Last edited by GrumpyOldMan; Apr 7, 2021 @ 4:52am
pontfogel Apr 7, 2021 @ 7:28am 
Perhaps combining a vs hold with an alt hold would be optimal for a remote control aircraft. You could even make it switch from vs hold to alt hold automatically at a set altitude.
Eagle Apr 7, 2021 @ 5:01pm 
Originally posted by pontfogel:
Perhaps combining a vs hold with an alt hold would be optimal for a remote control aircraft. You could even make it switch from vs hold to alt hold automatically at a set altitude.

This one isnt an RC. Its an actual piloted micro jet. BD-5 Replicated best I could.

The PID value I tried seems to have yielded the same results. Straight up vertical climbs then nose dives over and over again with the usual working setting for most planes of 0.1 on the P.

I tried 0.050 thinking halving the number due to the size of the jet would work but it
still does the same thing.

I dont know much about this game to try and make it hold the wings level also when I cant even seem to get it to target the right altitude so for now Im only going to focus on getting it to straighten out while its seeking the altitude set in the controller.

I only switch it on within 100 of the target altitude as Ive heard it breaks if you do it with a high deviation between current altitude and the target one of more than 100.
pontfogel Apr 7, 2021 @ 5:57pm 
Have you tried inverting the signal from the PID to your control surfaces?
Eagle Apr 7, 2021 @ 6:06pm 
Originally posted by pontfogel:
Have you tried inverting the signal from the PID to your control surfaces?
Yep thats how its set now. Havent worked on it today yet. But yes its signal from the output of the PID to the switchbox is inverted.
Eagle Apr 7, 2021 @ 6:27pm 
So when I place down the PID by default everything is set to 1 you guys said dont touch anything but the P value first so I reset everything to 1. Just does back flips now.
It is inverted from the output of the PID to the switchbox
pontfogel Apr 7, 2021 @ 6:32pm 
I said start with P and have I and D at 0. :)
Eagle Apr 7, 2021 @ 6:46pm 
Ok Im trying it out 0.50 on the P didnt work 0.25 didnt work

so I have the I an D set to 0.

No matter what i seem to enter on P all it wants to do is Pull straight then push the nose back down go nose diving then pulls up and up and up and goes into a cartwheel same reaction no matter what number I set it to. 0.1 didnt work 0.050 didnt 0.025 didnt 1 didnt 5 didnt no change at all in that whole number range.
Eagle Apr 7, 2021 @ 6:53pm 
Here is the process I set the P number take off level off and then enter the desired altitude to hold. Then I flip the switch. It noses up straight up pointing at the sky flatens out then continues to nose down till its in a straight down dive then it starts pulling up again and this time it pulls up until its past straight up and is now inverted then it stays in inverted for a few seconds then starts pushing the nose back towards the sky. Its literally drawing squiggle lines. No matter what I seem to enter its the same result. negative numbers 0 positive numbers.

I figured describing whats it doing might say if I have it hooked up or not. Im guessing its doing a normal reaction to PID setting according the comments on the altitude hold tutorial video I watched everyone in the comments said their builds were doing the same thing but people said try inverting the output from PID well I did that and its still not responding any differently no matter what I seem to put in for the P value.
Minnie Apr 7, 2021 @ 10:01pm 
Just so you know, even to seasoned professionals PID's are voodoo.
This read will help you tho :
https://pidexplained.com/pid-controller-explained/
now you know the actual math.
< >
Showing 1-15 of 26 comments
Per page: 1530 50

Date Posted: Apr 6, 2021 @ 9:26pm
Posts: 26