mpf icon indicating copy to clipboard operation
mpf copied to clipboard

Auto generate wire harness based on hardware

Open jabdoa2 opened this issue 4 years ago • 21 comments

Generate wire harness documentation using WireViz (https://github.com/formatc1702/WireViz) based on the hardware definition in MPF (switches, coils, PSUs and specifics for each hardware).

jabdoa2 avatar Jun 24 '20 16:06 jabdoa2

Hey, I would love to help with this. Where should I create the files/code to generate the documentation? I wasn't sure if there was a specific space it should be done at

nmbaker2000 avatar Sep 03 '20 03:09 nmbaker2000

I guess this could become a separate command in MPF: https://github.com/missionpinball/mpf/tree/dev/mpf/commands. We can then later refactor code into other parts. Does that make sense?

jabdoa2 avatar Sep 03 '20 07:09 jabdoa2

This sounds fascinating but how would it work? Just give the pinouts for the headers on the board, or show the ins and outs of every part? That could be a very big diagram?

hyphz avatar Dec 26 '20 21:12 hyphz

For certain hardware (i.e. FAST or Multimorphic) we show the headers for their node boards. Based on that we could generate wire harnesses. I guess we should start simple and then extend from there

jabdoa2 avatar Dec 26 '20 22:12 jabdoa2

So I manually produced this for FAST, how would this then work? Names of the connected switches/drivers shown in place of the ID numbers, or actual wiring shown? Would we need to know the physical locations of the parts on the playfield to get the sequence right?

fasttest

hyphz avatar Dec 27 '20 18:12 hyphz

Yeah exactly. We would have to discover the type of node boards for FAST (code exists for that) and then store a mapping for connectors to inputs/outputs. Based on the defined switches and coils we could generate a wire harness description for wirewiz, excel or similar tools

jabdoa2 avatar Dec 27 '20 20:12 jabdoa2

Ok. I tried to work out the basics of fast PSU mapping and got this, but it seems it could run out of control kind of easily? Also a bunch of confusion trying to work out the mapping but that's probably just me not really knowing anything about this.. fasttest

hyphz avatar Dec 27 '20 22:12 hyphz

Sweet. I guess we can think about separating exports later. This is better than what most makers got initially

jabdoa2 avatar Dec 27 '20 23:12 jabdoa2

I have no idea if it's right though, or what comparable would be for something like PROC. I sure as hell don't want to add something that generates a wiring diagram someone follows and electrocutes themselves.

hyphz avatar Dec 28 '20 01:12 hyphz

We can add a warning. This should only be a starting point. In production machines you will probably also have some additional connectors and you would want to edit the wirewiz by hand anyway.

jabdoa2 avatar Dec 28 '20 11:12 jabdoa2

Fair. Should I try to autogenerate FAST or start from a different one? Is there a good example using FAST? I see that demo_man uses P_ROC/WPC which would make sense, but I don't know if generating these diagrams is a priority for WPC tables that have existing wiring harnesses?

hyphz avatar Dec 28 '20 16:12 hyphz

Yeah FAST and P3-Roc make the most sense. Demo man is not optimal but it might be easy to modify it for those platforms. I mean just start the command and then we can create (or adjust) unittests in mpf.

jabdoa2 avatar Dec 28 '20 16:12 jabdoa2

Fair enough. Sorry, one other thing you mentioned above. You said that code exists for discovering node board types for FAST, I have found that code, but it applies only if the boards are already connected, is that the stage at which this would be used? Or would it be run before the boards are set up so they are not there to be tested yet?

hyphz avatar Dec 28 '20 17:12 hyphz

I've been looking at this but there doesn't seem to be any way to populate the machine. values for lights, switches, coil, etc. without calling initialise_mpf() which will try to connect to actual hardware and halt if it fails (obviously there is no point in calculating wiring for the virtual platform!). It would seem wasteful to use an auxiliary parser to translate all the stuff just for wiring but possibly rather disruptive to divide initialization into two parts?

hyphz avatar Dec 30 '20 20:12 hyphz

Ok, gotten this far. Wireviz doesn't like these huge images outputs though. It looks much better in SVG but I can't upload that. wiretest

hyphz avatar Dec 31 '20 20:12 hyphz

More complete now. Still becomes a huge file. FAST don't seem to have any data on their DMD-based or Servo controllers any more, is there documentation available somewhere? wiretest

hyphz avatar Jan 01 '21 17:01 hyphz

Sweet. Maybe we have to generate separate images for separate wire harnesses eventually?

I think I got a datasheet for the servo boards somewhere.

jabdoa2 avatar Jan 02 '21 01:01 jabdoa2

I'll tidy what I have to pass prospector for now.

hyphz avatar Jan 02 '21 17:01 hyphz

Is there a good archive of test tables? I was only able to use one of the sample open source tables from the web page, since most of the tables are not open source, and many of the open source ones are for older versions or contain specification errors.

hyphz avatar Jan 09 '21 19:01 hyphz

Have a look at: https://missionpinball.org/projects.html. In the bottom we got a list of machines with source.

jabdoa2 avatar Jan 09 '21 19:01 jabdoa2

Those are the ones I looked at, but as I said several are obsolete and some will not build.

hyphz avatar Jan 09 '21 19:01 hyphz