evil-mad / robopaint

The software for your friendly painting robot kit!
126 stars 34 forks source link

Allow RoboPaint to use remote CNC Server #137

Open techninja opened 10 years ago

techninja commented 10 years ago

This would allow for RoboPaint to connect to a headless CNC Server (as the early HTML only versions of the program used to allow). Should have support for all most options that RoboPaint currently uses (except bot type modification and other CNC Server options).

oskay commented 10 years ago

Excellent, excellent idea. Love to see this implemented.

techninja commented 9 years ago

As discussed in 179, this is mostly beyond the proof of concept phase and working in the branch, it just needs some follow-through. Note, the local CNCserver is STILL RUNNING to enable hosting the RoboPaint API, and it's likely it can be used as a relay for some complex modes of operation. Also, yes, this does work over the internet. If we get this working I'd be willing to poke a hole in my firewall and allow remote testing over webcam as I did with @RobotGrrl :)

The following specific requirements are likely:

The best part about the API and the wrapper is that RoboPaint should care very little about the server if it's running on the same process, or if it's on a RaspberryPi/Gallileo in another country. Also because of the buffer system overhaul, as long as your data gets to the device eventually, you can print smoothly. Though if it prints faster than its buffer fills, it's best to pause and wait. We all know how that goes on YouTube!

techninja commented 9 years ago

Some more detail on possible RELAY: Currently the Scratch offline v2 interface will ONLY look on localhost, meaning that external server + scratch = :cry:. Unless... we relay the local CNCserver commands to our target!

How would this work? well.. basically when a request comes in on one of the scratch endpoints, and if CNCServer somehow knew that it was only to be used for relaying to a known server/port, it could just mirror the commands sent to it, ignoring any actual execution... Actually this could be done with every request, less the fact that you'd have to rebuild the requests by hand, and that's MUCH easier with scratch because they're all GET requests that don't care what gets returned. The 30hz poll page requests might be a problem though... :P

docprofsky commented 9 years ago

Could CNCServer act as a proxy and relay all of the requests it receives to the remote instance? How hard would it be to make CNCServer reload the bot configuration when the bot type is changed?

techninja commented 9 years ago
  1. As I said in my second comment, yes you can make CNCServer relay commands (makes perfect sense for scratch interfaces), but unless there's some kind of express handler for that, you'd have to rebuild the requests. It's likely Express does have some kind of built in redirect/forward/relay system though.. should look into it. Though we also shouldn't let this get out of hand as the JS API wrapper was built to manage non-local server's and already has the reconfiguration code setup to pull from the external server.
  2. So... WHY is someone using an external server? I'm assuming because they want to use the Bot on WiFi, or perhaps it's too far away from their computer to reach with a USB cable. Because that's the case, it's likely the configuration on the machine it's connected to is quite specific and wouldn't change unless you were physically there to do something to it. Therefore, not only is changing bot type in CNCServer while running not an option, it's not feasible to support without more use cases that require it.
techninja commented 9 years ago

Moving this to 1.0, pending more conversation on what kind of plan we have for documenting/(supporting?) use cases. Also this is going to have to fit into the Introductory walkthrough in some form or fashion, likely hidden behind an advanced expander(?).

docprofsky commented 8 years ago

Is this implemented enough to close?

techninja commented 8 years ago

@docprofsky It's in the beta/master. Feel free to test.

techninja commented 8 years ago

This has been merged and can be tested as part of 2.0.0 Beta 2. It's not ALL there, but it is in UI.