Space Engineers

Space Engineers

287 ratings
[PARK] Piston And Rotor Keybinds
4
2
3
3
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
430.640 KB
Dec 9, 2019 @ 5:50pm
May 30 @ 3:45pm
16 Change Notes ( view )

Subscribe to download
[PARK] Piston And Rotor Keybinds

Description
This is a script intended to make things like cranes simpler and easier to control. It allows you to control rotors and pistons using movement commands through a cockpit. As a result, you can have four six axes of control, per profile (which I will explain a bit later).

This makes this script useful for things like cranes and possibly rotor based tank steering, although it could potentially be used for anything you want keybind controls for.

Update 1.3.0:
Another minor update adding in the setting "toggleRotorPower". Does the same thing as togglePistonPower, in case your build is really jiggly for some reason and want to be able to toggle off the rotors automatically.

Update 1.2.9:
Minor update adding in the setting "togglePistonPower" to only enable pistons for when they are moving. defaults to off in case you want to manually enable/disable pistons, but may reduce the noise pistons make while stationary if enabled.

Update 1.2.5:
Added return to zero functionality.
Three new terms have been added to the generated ini files, Return Position, Return Speed, and Return Order Priority.
When you run the command "Return", it will return each part to the set position, provided it has a speed set, in the order of the lowest Return Order Priority first.

If you set the Return Order Priority to -1, it will cause parts to return to their neutral position whenever their input isn't being received, and won't be considered when executing the return command.

Update 1.2.0:
Added in support for mouse controls with help from Marii. Now you can control your end effectors more... effectively.

Added in ramping so you can tap control things, as well as a general speed multiplier you can define with commands. With both of these it should be a lot easier to make small, precise movements.

Setup is surprisingly easy, even for how I predicted it to be.

1) Put all the rotors, pistons, and ship controllers in a group called "PARK" (You can change this in the script.)

2) Compile the script for the first time. It may give some warnings if the controllers have thruster or wheel control enabled. This does not prevent the script from running.

3) Go into the customData of the blocks and you will find something similar to this:

;Provide the RPM of the part when the corresponding key is pressed.
[PARK:Main]
Forward=0
Backward=0
Left=0
Right=0
Up=0
Down=0
Roll Left=0
Roll Right=0
Pitch Up = 0
Pitch Down = 0
Yaw Left = 0
Yaw Right = 0
Return Position=0
Return Speed=0
Return Order Priority=0

Each of the values represent movement commands that can be read through the cockpit. When the corresponding key is pressed, it adds the corresponding value to the velocity of the part. This is additive, it will sum up the total value and apply that value to the part. For rotors, it is RPM, for pistons, it is M/S, for suspension, it is the throttle ratio.

For example, if you want a rotor to turn clockwise when you press forward, and counterclockwise when you press backward, then you just need to set "Forward=[a_positive_value]" and "Backward=[a_negative_value]".

By default, the script ramps up in speed until it hits the defined speed over 3 ticks. This should make fine adjustments easier. You can change this at the beginning of the script.

Thanks to a recent addition added in by Marii, you can also use mouse controls to move components run by PARK.
The last four settings correspond to that.

Recently, I added in Return Angle, Return Speed, and Return Order Priority.
If you run the command "Return", it will return to the angle set, at a set speed, prioritized lowest first.
So if you want a part to return to 15 degrees at a speed of 2 RPM after the first set of the controlled parts moved, then you can do:
"Return Angle=15"
"Return Speed=2"
"Return Order Priority=1" (0 goes first, 1 is second.)
Setting Return Order Priority to -1 causes the part to return to neutral positon immediately after control is released.

Set this up as desired.

4) Recompile to get the script to recognize changes.

(Optional) The script allows you to set up multiple profiles. To add a new profile:

5) Go into the customData of the programmable block. Add the name of the new profile on a newline.

For example, the initial pregenerated profile should look like this:

"Main" (The actual value contained within quotation marks.)

And to add a new profile to it could make it look like something like this:

"Main
Secondary"

There is no rule that says you must add them one at a time.

6) Recompile the PB to get it to recognize changes. The PB will take the new string and use it to generate a new section in each block. This will appear similar to the the first example, but incorporating the name of the profile you just defined.

7) Set up as normal.

Commands:
"enable" Lets the script read commands from the cockpit.
"disable" Disables the cockpit from reading commands from the cockpit. The script will stop movement if it is moving.
"toggle" Toggles between the enabled and disabled states.
"return" Returns the parts to the defined zero position provided they have a return speed.
"mult <ratio>" sets the multiplier that effects the speed of configured parts. "mult 2" would double speed, for example.

Anything other than the above will be considered a command to switch profiles.
For example, typing "secondary" would cause the script to attempt to switch to that profile, and gives a warning if no such profile exists.

Note, the commands are not case-sensitive, at least for now.

Footnote:
I have noticed that often when people set up cranes in survival they usually just use clunky terminal options to actuate things. I hope that this system at least allows you to set up your cranes with more natural controls. I created this script to make it easier to control cranes without being all that much more difficult to set up. I hope you find this script useful.

TODO:
0) Not sure, feel free to leave suggestions for me.
Popular Discussions View All (3)
4
Jun 20, 2024 @ 10:32pm
Runs, but does not create the sample "Custom Data" info in the instructions
GrumpyGoblin
2
May 31, 2024 @ 10:42am
Exception, then initialising
Edmund Bestoiber
3
May 3, 2023 @ 4:35pm
Exception caught
Gemini Sierra
191 Comments
Leconite Jun 9 @ 3:55am 
First thought,
Check the lock status on the hinges / rotors, if they are locked, it can mess up PARK.
Second thought,
Check your park group, make sure everything is in there, recompile if you have to change anything.
Third thought.
More information about your build, what you need it to do, and how it should work.
Possibly custom data from the parts that are not working.
With that information, we may be able to give more relevant advice / troubleshoot.
SavageReaper185 Jun 7 @ 5:18pm 
someone please help. whenever i setup a secondary profile i lose all controls of my first profiles rotor and hinge, i can only get the first profiles pistons to go forward and back but nothing else, but the secondary profile will have full controls. i tried making a third profile and setting my main hinge rotor and pistons to that but still only the piston worked
Leconite May 27 @ 5:08am 
I stand corrected. My brain flipped the SIT settings around. :steamfacepalm:
TwistedGraphene May 25 @ 3:19pm 
I've had better results by using share inertia tensor on everything except the first subgrid link in an arm. Same for turrets. This results in the arm being treated as a cohesive component for how it reacts to external forces such as tool shake
Leconite May 22 @ 4:54am 
Usually, lowering the speeds of pistons; and the torque on rotors and hinges helps with the shaking. If you are using the share inertial tensor setting, only use it on the first subgrid link in the arm. Also, more data about how this drill arm is constructed would be helpful to the troubleshooting process. Not all PARK controlled drill arms are created equal. :-)
vi_o1 May 21 @ 6:24pm 
I’m trying to use this script to make a drill arm but the arm shakes like crazy and if I turn on the inertia dampers it doesn’t move. Any tips ?
DukeSatan Feb 23 @ 10:26am 
@V7I the keybindings you have set for vehicle control is all that can be used, but you can choose which of these controls the block you need to move; be it UP or FORWARD for say a piston extending. I made a small excavator today which has PARK and SWCS scripts in, anyone having difficulty with these should take a look at how I've setup the vehicle: https://steamcommunity.com/sharedfiles/filedetails/?id=3433063512
NOOBZNYTMAR3 Feb 10 @ 2:31am 
script works great till you enable share inertial tensor on rotors used as vtol pivots then it gets all weird but i need inertial tensor on to not cause clang noises any tips tricks or help?
V7I Feb 9 @ 3:59pm 
is there a way to change what buttons it uses?
Leconite Jan 15 @ 9:02am 
That might be a good idea for a future version of PARK, to automatically unlock affected units before initiating movement.