missionpinball / mpf

Mission Pinball Framework: Open source software to run a real pinball machine.
http://missionpinball.org
MIT License
216 stars 142 forks source link

Auto generate wire harness based on hardware #1523

Open jabdoa2 opened 4 years ago

jabdoa2 commented 4 years ago

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).

nmbaker2000 commented 4 years ago

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

jabdoa2 commented 4 years ago

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?

hyphz commented 3 years ago

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?

jabdoa2 commented 3 years ago

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

hyphz commented 3 years ago

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

jabdoa2 commented 3 years ago

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

hyphz commented 3 years ago

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

jabdoa2 commented 3 years ago

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

hyphz commented 3 years ago

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.

jabdoa2 commented 3 years ago

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.

hyphz commented 3 years ago

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?

jabdoa2 commented 3 years ago

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.

hyphz commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

jabdoa2 commented 3 years ago

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

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

hyphz commented 3 years ago

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

hyphz commented 3 years ago

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.

jabdoa2 commented 3 years ago

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

hyphz commented 3 years ago

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