Space Engineers

Space Engineers

283 avaliações
Gravity Aligner
3
2
   
Premiar
Adic. a Favoritos
Nos Favoritos
Desfavoritar
Tamanho:
Publicado em:
Atualizado em:
60.782 KB
2 dez. 2015 às 21:38
29 abr. 2019 às 10:28
25 notas de alterações ( ver )

Subscreve para transferir
Gravity Aligner

Numa coleção por p3st|cIdE
Scripts
13 itens
Descrição
A stripped down version of Hover Altitude Aligner!

or a bells-and-whistles version of Leveller?! lol

Are you tired of crashing ships on planets because you weren't paying attention to the alignment as you cruised around and slewed into the ground? This is the script for you! It automatically aligns a ship with the local gravity using gyro overrides. When it detects it's going out of alignment, brings it back into alignment, and shuts off the overrides. It can effectively make a ship yaw-only, or just limit the angle of how much roll and pitch is allowed relative to flat orientation. It effectively turns a spacecraft into an imprecise orbiter. Folks have even been abusing it to keep mechs from falling over!

The main thing it does is prevent a vehicle from flipping over or even tilting too much. I made it because some of my ships were never designed to fly sideways or upside down and will definitely crash when put into those alignments, I got tired of having to manually orient the ship constantly to correct accumulated roll and REALLY got tired of crashing expensive space ships due to negligent piloting.

All it needs is a programmable block (for the script), a cockpit (to discover gravity vector and vehicle orientation; a remote control block will work if manual steering isn't required), some gyros (any orientation), and optional text panel(s) for diagnostic info. Ensure all blocks have access to each other/same owner. Then make a new group in the terminal called "Aligner" and include ALL those blocks. Then Run the programmable block with argument "go" and watch it line up. Just try to flip the ship over, I dare you!

To disable the aligner, just run it with an argument of "stop" (case insensitive). It will ignore further runs for .1 seconds just in case and turn off the text display. "toggle" is convenient for toolbar binding.

The text panel diagnostics will tell you if you're missing a block or some other critical setup error. So far it outputs to the public text the present ship pitch and roll angle in degrees, blinks red when it's aligning, has pretty angle graphs.
Angle graphs go best on corner panels, put into LCD public title "pitch", "yaw", "roll", "steer", "logo", "gravity", "update", a few others slip my mind...

I find it easiest to steer with the keyboard arrow keys. Hey, it even supports the new player input access for true gravity-relative yaw control!

You will definitely want to tune the parameters in the CustomData for your ship, but do be careful and make a backup copy of your ship first, I can take no responsibility if you manage to make the thing freak out and crash by tweaking wrong parameters, but the defaults should do ok for most uses. If you need help tuning the parameters, let me know. Often the settings will get cleared or reset mysteriously, so once you find settings you like, it's best to edit the script to make those the new defaults.

It only uses blocks in the group, so you can exclude some gyros for other purposes.

If you would like to see this script working in-game without having to build a ship and set it up, I have some ship blueprints uploaded that already have it installed. Try VixS. Can find more by browsing my recent Workshop submissions. Some old versions are Drilldown, or Flitter, both good examples without mods. Also Overlook scout ship. Some may be using old versions of the script though; my earliest attempts aren't as nice with the response at the limits and did block setup differently, can't handle arbitrary remote orientations. Some include airlock logic!

It's a fairly cpu-friendly script since even though it gets run every frame, most of the script can be skipped if enough time hasn't elapsed and the block searching initialization only runs every 5 seconds and main control logic presently only runs 30x per second by default which is plenty good enough for most ships. Try reducing updatefrequency and disable the text panel to reduce server load on multiplayer.

NOTE: it still depends on inertial dampeners and upward thrusters to keep the vehicle in the air. AND you can totally still crash the ship! It merely assists maintaining alignment.

TROUBLESHOOTING

There's no shortage of problems with a script like this which basically remote-controls the ship.

Ensure block ownership. Permission issues can prevent scripts from manipulating blocks etc. It does check for this now. This is the most common source of error.

If it doesn't seem to be doing anything, did you give it the "go" command? Check the programmable block to see if it threw an exception.. If there's no text panel more exceptions might happen. Try with lcd first, you can remove when it works.

If it won't correct at all, make sure you can actually steer the ship manually (have enough active gyros to move it?)
If you see no debug output on your text panel, make sure you own it and then set to show public text. Is it in the group?

If it seems too stiff and jerky and won't let you steer, try loosening up the angle limits or speed factor in the script parameters. Group a cockpit, not a RC.

If it takes too long to correct, turn up the AlignAngularResponseP or increase the OrientPredict time.

If it never actually gets to the limit and keeps correcting forever, preventing you from steering, try increasing AlignAngularResponseP.

If it overcorrects too far past the boundary limit, or oscillates a lot, won't settle into a small limit window, try increasing OrientPredict time or decreasing AlignAngularResponseP, or increasing AlignAngularResponseD.

Try turning up AlignAngularResponseD especially if it's a huge ship, to prevent gaining excessive velocity.

If you get CLR Detected Invalid Program errors, try installing the latest .NET runtime (4.6.1 reportedly works!) I still haven't figured out the cause.

KNOWN BUGS

Can reset CustomData config settings to defaults sometimes, on some ship designs, on server load - make a backup!

LCD panels often show the wrong chart; chart configuration doesn't work right anymore.
945 comentários
Rubber.Band. 17 de out. às 1:31 
Thanks <3
p3st|cIdE  [autor] 16 de out. às 18:30 
@RubberBand try the command "PitchAngleClipDegrees=45|RollAngleClipDegrees=45"
Rubber.Band. 16 de out. às 17:19 
How can I set this to only stop me from being able to tilt past a certain degree, do not auto align just prevent me from tilting too far?
p3st|cIdE  [autor] 16 de out. às 3:25 
I apologize to everyone for the quality of the instructions. That's just lack of spare time to finesse them, and/or me being lazy. This script is really old, it probably did require a RC at one point. I will update the relevant section. Yeah, the Remote Control functions as a IMyShipController, so it *can* work, but yeah if you use that as your group's 'cockpit', you wouldn't be able to steer manually. Sorry for the troubles.
Monstertruck 16 de out. às 1:50 
I think i found the problem! It's not the script, it's the instructions being just slightly misleading.

Here on the steam page it's clear that the script needs a remote control block OR a cockpit. In the instructions you read in-game, it only mentions the remote control block.

If a remote control block is used with the script, but the player controls the ship through the cockpit, steering is very limited or removed.

Script seems to work after removing the unneeded remote control block and binding the script to cockpit instead :)
Monstertruck 16 de out. às 1:40 
I tested the script. My small ship corrected and aligned to gravity, but I'm having the same problem. I can't turn. The ship can only strafe and go up/down with the script enabled. My ship is really basic and small with 1 gyro.
p3st|cIdE  [autor] 15 de out. às 7:30 
@Earth strange, I just tried it in Creative and it's working as expected. I run it with the "toggle" command from the toolbar, it aligns just fine with default parameters. I'll be testing and updating my scripts more in the upcoming days as I explore the new update. About damn time Keen gave us some new content!
p3st|cIdE  [autor] 15 de out. às 5:39 
@Earth tyvm for the report, will investigate. Keen probably changed something.
Earth 14 de out. às 18:45 
Hi, I have used this script for a long time (its great), but recently, as others have been noting, when you have the script running, it fully disables movement along all axis, including yaw. Even using keyboard inputs, a ship with this script running (after running with "go") will not turn whatsoever. This wasn't previously the case.
p3st|cIdE  [autor] 14 de out. às 17:41 
just read the directions, it's the main point of the script. You're probably missing the "go" command. By default it also corrects pitch, you can disable that in CustomData. Be sure to "load" after editing CustomData.
If you have a more specific question, lmk.