KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
691 stars 229 forks source link

Suggestion: PLC version of kOS computer #666

Open pgodd opened 9 years ago

pgodd commented 9 years ago

A programmable logic controller is typically a dedicated device to monitor and control a subset of process control. In practice, they are dedicated little programmable computers that break down large processes into smaller, more manageable tasks. They may operate on their own, or as part of a network of units operating like logical subroutines.

In programming robotics, I have found several practical challenges with kOS. I am up to 5 computers for my six legged robot. Think about it; 6 legs, with three knees, one hip, one rotating "ankle" and a driven wheel. That's 36 separate devices. I have found the process of discovering the parts by tags, organizing them into logical groups, assigning module names to them etc. can inflate that number again by an X factor. The end result is I can't even load my variables in the space available for program storage.

If a PLC device could be assigned to a part by a selection menu in the ship editor, and a boot program could be assigned by the established means, the list of part module variables could be pre-loaded, avoiding the need to build large lists of devices and part modules.

This could greatly reduce the complexity of a main program; accomplishing exactly the same task as PLCs do when used in industry.

I can develop a PLC module 3D model. I'm not sure if I could do the rest, but I'm willing to try.

pgodd commented 9 years ago

A menu item added to the editor context menu of each part could be called "add PLC". Every available part module variable would be automatically populated. The PLC would be addressable as the tag name of the part itself. "Add PLC" would not be available until a tag name is assigned. The boot program in this case would be named after the tag name. Prefix for PLC programs would be PLC. So a part tagged "right ankle" would have a program called PLCright ankle.ks

pgodd commented 9 years ago

I've been playing around with this, and i think I'm leaning towards using existing code. I'm especially interested in using this for IR projects right now. using kOS you could re-tag components to achieve coordinated movement. Device travel limits could be reset on the fly to achieve an exact seek position. We need more string tools, because once a batch of devices is set to all the same tag, how do you rediscover them? Name parsing would help. Did I see that in the docs? I have to check.

ZiwKerman commented 9 years ago

Basic string parsing is on the radars, and is not that hard to do, but needs some other things to be taken care of.

As for IR - we're currently reworking a fork of IR to make sourcecode more readable, reliable and faster and whole mod more user friendly. One of the goals is to introduce proper API to IR and integrate KOS much closely than now.

ZiwKerman commented 9 years ago

oh, the issue number is Infernal indeed :)

If you're too eager for basic string parsing and don't mind compiling yourself you can look at this discussion: https://github.com/KSP-KOS/KOS/issues/636

there are bits of code you can add yourself to create your own functions in your version of KOS