Space Engineers

Space Engineers

93 ratings
[v1.5.4] MECS: Motor Extensible Control Sequencer
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
895.513 KB
18 Jun, 2018 @ 4:01pm
25 Oct, 2022 @ 8:52pm
16 Change Notes ( view )

Subscribe to download
[v1.5.4] MECS: Motor Extensible Control Sequencer

Description
MECS, my latest creation! I made this software from the ground up so that I could sequence things without the need of timers, making it a very compact and safe option for walkers, and a very powerful tool for automating factories.

v1.5.4
Fixed issue with commands not being sent if parts happen to be in correct positions. Ensures parts don't skip and then get stuck because they happened to be passing through the complete range.

v1.5.2
MECS now works in degrees instead of radians. This should make editing the customdata slightly easier to deal with. The system will perform the conversion to degrees on old sequences without breaking them.

You can now record and set the torque of a rotor. If rotor torque isn't present in the customdata it will add it in. However, if you have a really old sequence you might need to reload the script a second time for changes to take effect.

Unlocked setting on servos now works like you would expect. Rotors with this tag in their customData will now rotate the shortest distance every time, without having a min and max angle. This was a bit fiddly to get right but it works.
Please note that in unlocked mode rotors have to set the opposite angles to +-180 to avoid slider collisions.

I also made an internal change to the keybinds system. The system will now filter out keys that have no sequence applied to them. This makes it more compatible with itself and other systems as well. For example, a design with just w/s controls only takes the w/s keys into account.

What it does:
It stores a list of positions/states, and uses that information to send commands to all the the different parts to achieve that state.

Basically, in a robot arm, it will try to get all the rotors and pistons in the correct position and advance when they reach it. For doors it will wait until they are completely open or closed (although there is a neat caveat with doors). Landing gear it will wait for it to lock. Or not, depending on how you record it's state.

You can train this behavior just by toggling the blocks yourself and then telling the program to read the state.

In addition, you can now tell the script to read controls from any ship controller, allowing you to bind sequences to key presses.

Guide:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1420398166

Known issues:
0) If you try to run an argument that takes a name and enter a space but not anything after it it will crash.

1) On rare occasion the game will crash when the program is trying to read from a projector. This mainly has occured to me when it is running nonstop and I am alt-tabbing in and out of the game. Perhaps it has to do with me cycling the projector's power to force it to update too quickly? I wouldn't mind if someone presented a better solution.
EDIT: As of 1.2.2, this problem should be resolved. Whiplash let me know of a more effective solution, which was pretty cool of them. Please let me know if this bug rears it's head again.

2) Since v1.3.9, there seems to be a scenario where the script will not update properly after updating keybinds, thus, not actually reacting to those key presses until you recompile. I actually can't remember if I fixed this one or not.

Currently scheming:
0) Overhaul the guide.
1) Sequence optimiser. (To reduce size and impact of a sequence by removing unnecessary information.) (v?.?.?)
2) MECS 2 at some point???

Footnote:

I created this with the intention of making it easier for people to make things like mechs and factories without having to worry too much about code. I hope this serves as a useful tool in your arsenal, and enables more amazing creations!
Popular Discussions View All (2)
8
27 Mar, 2021 @ 9:09am
Bug Report
Trekki
3
25 Jan, 2022 @ 7:09pm
General Feedback
Trekki
47 Comments
ribera1945e 11 Jun, 2024 @ 2:44am 
I trained it with the restrictions applied, then edited the sequence to make it work perfectly, but after the signal update it stopped working properly.
Trekki  [author] 11 Jun, 2024 @ 2:10am 
I can only guess, but did you train it with the rotor without any limits set? IIRC, the angles when it has no limits versus when it does have limits are different to the code for some reason, so maybe that would be the reason?
ribera1945e 11 Jun, 2024 @ 1:27am 
The problem is step 1, where "fbend" starts after "fbstart" ends. WingBinder R2 and WingBinder L2 go out of limit when moving from 210 degrees to 120 degrees.

0~servo:Hinge WingCannon Yaw R:75:-10:1E+07:False:True`servo:Rotor WingBinder R3:-160:-15:1E+07:False:True`servo:Rotor WingBinder R2:210:15:1E+07:False:True`servo:Rotor WingBinder L2:-210:-15:1E+07:False:True`servo:Hinge WingCannon Yaw L:75:-10:1E+07:False:True`servo:Rotor WingBinder L3:160:15:1E+07:False:True
0~servo:Hinge WingCannon Yaw R:75:-10:1E+07:False:True`servo:Rotor WingBinder R3:-80:15:1E+07:False:True`servo:Rotor WingBinder R2:120:-15:1E+07:False:True`servo:Rotor WingBinder L2:-120:15:1E+07:False:True`servo:Hinge WingCannon Yaw L:75:-10:1E+07:False:True`servo:Rotor WingBinder L3:80:-15:1E+07:False:True
ribera1945e 11 Jun, 2024 @ 1:20am 
I am making a wing that can stop in multiple positions.
When moving from the stop angle to the target angle it goes out of limit and stops moving.
Trekki  [author] 25 Oct, 2022 @ 8:52pm 
Alright, it seems that the thumbnail being almost 2 megabytes was the cause.
Trekki  [author] 25 Oct, 2022 @ 8:45pm 
Okay, I have fixed this problem where it will not know what to do with limbs that are already in a deadzone when it executes a step, however, I can't seem to upload the fix.
Kalinite 9 Sep, 2022 @ 9:01pm 
i have recompiled the scripts MANY times. they don't budge. any attempt to fix them will not work. stopping, starting, setting it to a walk position.. the specific one im working with is the custom jaeger chassis, of course. probably one of the most popular examples of MECs, although they could've just used AW2. nothing works. its stuck in the position perm. i cant fix it.
Kalinite 9 Sep, 2022 @ 9:00pm 
the thing is i forgot to add: BLUEPRINTING.

you blueprint this state while you're working on the mech you're done for and you could've gotten very far which is even more pain.
Trekki  [author] 9 Sep, 2022 @ 8:30pm 
I am not sure it saves when you copy it. Probably something I should test when I get the chance. If the script isn't restarting and there is no other reason why it stopped, recompiling the script after giving it the command to walk might help? But also, if someone else copies and pastes the thing, they might need to recompile the script anyway because of the ownership change.

I am kind of curious though, by break, do you mean the script just doesn't restart automatically after being copied? That is what I am guessing but I can't be 100% sure.
Kalinite 8 Sep, 2022 @ 9:29pm 
(i have not read anything, tell me if theres a method to fix it)

can you add a fix feature to the script that basically restarts it from the beginning, because this script fries STUPID easy, copy it when its walking. it breaks. thats whoever did that's fault. but it does it when it stands AFTER a walk aswell.