Introducing MK404 - The Prusa Printer Simulator!
 
Notifications
Clear all

Introducing MK404 - The Prusa Printer Simulator!  

  RSS
vintagepc
(@vintagepc)
Member
Introducing MK404 - The Prusa Printer Simulator!

Howdy everyone! Some of the more regular users around here might have noticed I've been less active recently. Today, I'm happy to share why; a little project I've been working on since early April, dubbed "MK404 - (Printer Not Found)".  (Yes, that's a deliberate reference to Prusa's 404 site error page in addition to jesting at it being a virtual printer).

(Lengthy text interspersed with various development images/screenshots just to keep it from getting too dry)

What is it?

It's an open source project based on SimAVR, with all the virtual components found in a MK3S (And more - see Features for more details on what it has or doesn't have. I'm still awed by the technical aspects behind the scenes that most people won't even bat an eye at - like custom char support on the LCD implementation). That means it runs the stock Atmel hex files for the most accurate possible simulation. It's primarily focused towards firmware developers and people that want to experiment with firmware customization as a debugging tool - without risking downtime on their real printer. What's more, you can use the advanced debugging features to safely inspect internal states you'd otherwise only be able to do with an ICD, if at all. (As you can imagine, breakpointing realtime operations and/or live systems with heaters is risky business...)

First completed boot

Why now?

The project has been ongoing since early April and I've been working on it in my spare time, with contributions from the usual notorious firmware guys you've seen before in the Dev Diaries post - leptun, wavexx and 3d-gussner. (Also, shout-out to Gregoire S. for contributing Bear models - see Features...). It's been a long haul and while we've been public since late July, it's taken until now for me to be happy with the state of the project as something I would be satisfied calling "v1.0". (Currently, it's an RC in case there are any last-minute bugs identified). Much of that work was ramping up the system to more readily support outside contributions, with things like automated tests, code linting, etc. 

I feel the time has come for an announcement to gain a wider audience that might play around or have use for it, and test it/report bugs. I am sure there are plenty to be found.

Marlin fail

 

Where did the idea come from?

This started as a tongue-in-cheek remark back when FW3.9.0 was in the RC stage and had issues with LA1.5. Debugging that was proving to be a bear, so at some point I joked about simulated hardware. One thing led to another and a casual investigation snowballed into what we have today. 

What is it not?

It isn't a real life physics simulation. Overhangs are always perfect, bridges don't sag, and prints never detach. 😉  Some internal details that are not particularly relevant to normal operation are ignored or abstracted away. But I'm always looking to improve the hardware simulation capabilities and accuracy. 

Nor is it a high-speed print G-code visualizer. It runs slightly faster than real-time. We'd like to find a way to run the simulation at full throttle but that introduces other problems when it comes to external interactions (like an attached MMU2)

Platform disclaimer:

The simulator is developed on Linux; this is SimAVR's native platform. OSX and Cygwin are "unofficially" supported as best I can. (See Supported Operating Systems for more info on what/why. If you encounter bugs on the latter platforms, please verify if they are reproducible in the Linux build and include this info in your bug reports, if possible. 

Highlights:

  • Extensive simulation of hardware components - LCD, PINDA, SD cards, Motor drivers, heaters, thermistors, etc, conveniently controllable through a lightweight display and context menu. (Seriously. It runs fine on integrated graphics from 2013)

Heaters

Menu

  • This includes the MMU2:

  • Yes, you can control it via serial/pronterface/octoprint and send G-code to it, or load said g-code to the virtual SD card. 
  • Extensive back-end scripting and telemetry capabilities for debugging or evaluating firmware behaviour. 
  • If you crave something less 90's for your UI, it also offers full and lightweight 3D visualizations - your choice of Bear or stock models (Images slightly out of date, and improved since they were taken)

Bear

  • See the main project README for a more expansive list of features and capabilities. 

It's not a printer until it prints a Benchy!

I'll just leave this here, then...

Second benchy

(And yes, the MMU2 prints in different colours)

 

Marlin!

... That's not even a question. But yes:

Marlin boot

 

Does Prusa Research know about this?

The firmware team is certainly aware of it. That's about all I know for sure. But I don't work for PR, nor is it officially endorsed by them.

Does Jo know? Can Jo sign my virtual printer?

... Maybe? You'll have to ask him. But his clones are probably all busy signing and packaging real printers, and their Jo-clone source code is not publicly available. 

MK4? PrusaXL?

Go back to flooding the livestream chat or twitter tab. I can't help you, sorry. 

Future Plans?

  • More printers... The miniRambo and its associated hardware are currently under development so hopefully for v1.1 we'll see addition of the MK2- based line. This will probably also include an MMU1, because why not? (The hardware is relatively simple)
  • More printers... It's organized such that it should be easy to re-use existing components to add new printer models with existing parts. Though there are limitations on the SimAVR core (which is limited to more classic 8-bit AVRs like the 2560). SimAVR is also extensible, but I don't see a 32 bit simulation for the Mini any time soon. 
  • For kicks we might even add the original i3... assuming we can find art assets and sufficient design docs for it. 
  • Whatever else tickles my fancy. Community contributions to the project are welcome.

Where do I get it?

The project is completely open-source on GitHub. Compile it from scratch or try out some pre-built release binaries! 

Also be sure to check out the Project Wiki for assorted tidbits on scripting, telemetry, historical screenshots, and more.

Anything else?

Nothing comes to mind. But I'm sure that after posting this there'll be a flood of GitHub bugs, feature requests, and more. I'm only one person with a full time job outside of this, so I'll get to them when I get to them. 

Posted : 13/09/2020 3:46 pm
Nikolai, jsw, karl-herbert and 1 people liked
bobstro
(@bobstro)
Illustrious Member
RE: Introducing MK404 - The Prusa Printer Simulator!

This should be handy for determining what should work before starting a lengthy print.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 13/09/2020 4:38 pm
vintagepc liked
karl-herbert
(@karl-herbert)
Illustrious Member
RE: Introducing MK404 - The Prusa Printer Simulator!
Posted by: @vintagepc

Howdy everyone! Some of the more regular users around here might have noticed I've been less active recently. Today, I'm happy to share why; a little project I've been working on since early April, dubbed "MK404 - (Printer Not Found)".  (Yes, that's a deliberate reference to Prusa's 404 site error page in addition to jesting at it being a virtual printer).

Very good idea and work. I will have a look at it and test it in detail.

This would of course make testing the firmware much easier and faster 👍 .

Why did Prusa not come up with this idea?

wbr,

Karl

Statt zu klagen, dass wir nicht alles haben, was wir wollen, sollten wir lieber dankbar sein, dass wir nicht alles bekommen, was wir verdienen.

Posted : 13/09/2020 4:44 pm
vintagepc liked
jsw
 jsw
(@jsw)
Famed Member
RE: Introducing MK404 - The Prusa Printer Simulator!

Ok, I'll bite.  I'll give it a try and see what happens.  😉

Posted : 13/09/2020 6:17 pm
vintagepc liked
vintagepc
(@vintagepc)
Member
Topic starter answered:
RE: Introducing MK404 - The Prusa Printer Simulator!
Posted by: @karl-herbert

Why did Prusa not come up with this idea?

wbr,

Karl

I'm guessing that several years ago when they first started making printers the 2560 was "fairly new" and emulation was relatively unavailable, or incomplete (Even I had to make some upstream contributions to SimAVR to get everything functioning - and even with a functioning core, simulating all the components around that core is not an insignificant task. In fact, I can tell you it's about 6 months of spare time... 😀 ). It probably was an executive decision to focus on the firmware itself and mass-testing them in the print farm than devote developer hours to a potentially fruitless venture if it didn't pan out. 

Based on previous announcements and posts about firmware releases, they do a lot of hands-on testing as well - and even the best simulator can't really predict what will happen once the real world decides to throw a wrench in "theoretically correct". Since they basically have an infinite number of printers at their disposal for testing... things probably just continued as they were. But for those of us with just one or two printers (or possibly not other models on which to test/verify a change)... it comes in very handy as an extra layer of reassurance and sanity testing... Or just something to muck around with. 

All of this is just a guess though, mingled with a bit of first-hand knowledge of embedded development for other things where hardware simulation has played a role. 

For me, it was also a challenge; I learned a phenomenal amount about the inner workings of the printer/board and we even uncovered a few things along the way that lead to actual improvements in the official firmware. 

Posted : 13/09/2020 10:33 pm
Pedroid
(@pedroid)
Trusted Member
RE: Introducing MK404 - The Prusa Printer Simulator!

Congratulations for this awesome work!

Over the last month was discussion of layer shifts regarding octoprint and its plugin DisplayLayerProgress. Can this simulator be used to track that problem down?

Best regards, Olaf

Posted : 14/09/2020 5:21 am
vintagepc liked
vintagepc
(@vintagepc)
Member
Topic starter answered:
RE: Introducing MK404 - The Prusa Printer Simulator!
Posted by: @olaf-groeger

Congratulations for this awesome work!

Over the last month was discussion of layer shifts regarding octoprint and its plugin DisplayLayerProgress. Can this simulator be used to track that problem down?

Best regards, Olaf

Depends on the nature of the issue - but if the problem is due to software glitches (e.g. buffer corruption, overloading the Einsy so it skips steps) then I think it should be reproducible with the simulator - at which point, yes, you should be able to dive in. I haven't had to do it yet myself, but it's possible to breakpoint the executing AVR code - SimAVR has full GDB support.

Posted : 14/09/2020 11:31 am
Pedroid liked
mjlewis37
(@mjlewis37)
Trusted Member
RE: Introducing MK404 - The Prusa Printer Simulator!

Bravo!

Posted : 14/09/2020 3:06 pm
vintagepc liked
vintagepc
(@vintagepc)
Member
Topic starter answered:
RE: Introducing MK404 - The Prusa Printer Simulator!

I'm pleased to note that the miniRambo based-printers are coming along faster than I thought they would (albeit no 3d graphics yet)... so a 1.1 could follow in short order.

Bonus picture for those craving some nostalgia....

image

Posted : 16/09/2020 5:08 pm
Share: