LaserWeb4 icon indicating copy to clipboard operation
LaserWeb4 copied to clipboard

Buildbotics integration

Open jcoffland opened this issue 6 years ago • 19 comments

Would love to integrate LaserWeb4 on the Buildbotics CNC controller. It has a built-in Raspberry Pi 3 so it could serve LaserWeb over the network. It would not take much effort to connect it up to the Buildbotics control firmware. https://github.com/buildbotics/bbctrl-firmware

jcoffland avatar Sep 06 '17 05:09 jcoffland

Just follow the installation instructions on https://cncpro.yurl.ch/documentation/installation/36-install-raspberry-pi and you can connect the frontend over Raspi-IP:8000.

cprezzi avatar Sep 11 '17 08:09 cprezzi

I don't think that's quite what we want to do. I would like to serve the HTML, Javascript and CSS parts of LaserWeb4 from the RPi and have our Python based server code act as the "serial port server" on the backend. Do you think this could work? Am I missing anything?

jcoffland avatar Sep 12 '17 17:09 jcoffland

Unless your python code replicates lw server api, you will still need lw server to do connection :|

El 12 sept. 2017 7:33 p. m., "Joseph Coffland" [email protected] escribió:

I don't think that's quite what we want to do. I would like to serve the HTML, Javascript and CSS parts of LaserWeb4 from the RPi and have our Python based server code act as the "serial port server" on the backend. Do you think this could work? Am I missing anything?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/411#issuecomment-328926351, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYJsQLQTf_KZVMQj4RJ-yz7FoNx93ks5shsBXgaJpZM4PN3A2 .

jorgerobles avatar Sep 12 '17 17:09 jorgerobles

What does the LW server do? Is it more than just a serial port server? Can you point me to docs on the API?

jcoffland avatar Sep 12 '17 18:09 jcoffland

Lw comms server provides an abstraction layer for the hardware,

Check https://github.com/LaserWeb/lw.comm-server

El 12 sept. 2017 8:49 p. m., "Joseph Coffland" [email protected] escribió:

What does the LW server do? Is it more than just a serial port server? Can you point me to docs on the API?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/411#issuecomment-328946320, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYDy4zvawBl4X9GvpZKxvcRe1XEhRks5shtIhgaJpZM4PN3A2 .

jorgerobles avatar Sep 12 '17 19:09 jorgerobles

Note that the API may change: https://github.com/LaserWeb/lw.comm-server/issues/47

tbfleming avatar Sep 12 '17 19:09 tbfleming

Our Python code already contains a WebSocket server. I wonder if we couldn't just implement the API directly. Our server does not need to support TinyG, GRBL or Smoothie. Its only purpose would be to support the Buildbotics controller. I found the API docs. It doesn't look too difficult but it would be nice to have some more details on the API. I.e. exactly what the data format should look like.

jcoffland avatar Sep 12 '17 19:09 jcoffland

I thought the Buildbotics controller was TinyG.

tbfleming avatar Sep 12 '17 19:09 tbfleming

If I had a $ for from everyone that thought it was a TinyG in a fancy box our Kickstarter would be funded already. We did start out with the TinyG firmware but we've made massive improvements and changes. The API between the RPi and the AVR is similar to the TinyG but there's a lot more to our controller. We have a Python program which runs on the RPi which adds a lot of functionality. I need to have that code in the loop. For this reason, the interface to LaserWeb would be very different.

jcoffland avatar Sep 12 '17 19:09 jcoffland

@jcoffland You will have to check the server source for all websocket events and emits. I did not plan to document the whole API in detail (too much time consuming).

cprezzi avatar Sep 12 '17 19:09 cprezzi

Perhaps I can help with documenting the API. It appears to be JSON data in both directions. It would be nice to have something like this: http://dev.buildbotics.com/ for all the API entry points. The important data is:

  • Request method (HTTP method, Websocket, etc.)
  • Request format
  • Response format

How do you associate requests with responses over Websocket?

jcoffland avatar Sep 12 '17 19:09 jcoffland

How do you associate requests with responses over Websocket?

It doesn't. In most cases it broadcasts changes to all connected clients io.sockets.emit(...). It sometimes sends changes to a single client, but there's not a good way to associate it with a specific request.

Something to watch out for: it uses the socket.io package, which provides its own versioned protocol. socket.io clients and servers refuse to talk to each other if the socket.io protocol version don't exactly match. The server sends the package source to the client to keep the two sides in sync. All this is under the control of socket.io. I hate it and hope to eventually dump it.

tbfleming avatar Sep 12 '17 22:09 tbfleming

Sorry, but I love the way socket.io works and I don't see any reason to replace it.

cprezzi avatar Sep 13 '17 10:09 cprezzi

I hate react/redux, but I do not try to replace it ;) (I would prefer Meteor)

cprezzi avatar Sep 13 '17 10:09 cprezzi

socket.io stops other languages from talking to the server.

tbfleming avatar Sep 13 '17 11:09 tbfleming

I had the same problem with socket.io. I ended up switching to SockJS because I couldn't get socket.io to work with Python. On the Python side, I'm using tornado and sockjs.tornado.

jcoffland avatar Sep 13 '17 18:09 jcoffland

I have a working example of the Python3-socketio implementation for communication with LaserWeb4. https://gist.github.com/Haschtl/e4953ca8a15c53a079d871fa74a03f68

It's working quite good. You may not need the functions at the end of the API. I just made these to have the same data-structure as my Octoprint-PythonAPI, because i'm using both on one RPi

Haschtl avatar Jul 07 '19 19:07 Haschtl

@Haschtl Nice stuff, appreciate your work!

cprezzi avatar Jul 08 '19 11:07 cprezzi

Thanks! I had some errors in the PythonAPI, just fixed it.

Haschtl avatar Jul 08 '19 14:07 Haschtl