Command-line control

Post technical questions about the Buildbotic Controller here.
Forum rules
No profanity, no gambling, no illegal activity, so sexual or pornographic material.

Posts not related to the Buildbotic CNC Controller are likely to be moved or deleted.
Post Reply
unmannedman
Posts: 1
Joined: Sat Feb 23, 2019 2:59 am

Command-line control

Post by unmannedman » Sun Feb 24, 2019 8:59 pm

Is there a way to configure and start Buildbotics CNC Controller program through Linux command-line (through SSH ) or API? I have tried to find any relevant information but failed so far. What I am looking to do is to configure and command stepper motors-based motion platform (potentially controlled by Buildbotics CNC Controller) through external (network connected) Linux-based system from command line or Python scrip level.

There seems to be Buildbotics API over HTTP (http://dev.buildbotics.com/) however its documentation does not mention specifcally any "Program" related commands.

User avatar
Joe
Site Admin
Posts: 8
Joined: Fri Feb 02, 2018 2:00 pm
Location: Petaluma, CA
Contact:

Re: Command-line control

Post by Joe » Tue Feb 26, 2019 9:53 pm

It is possible to control the Buildbotics controller over HTTP. It's not documented but this is how the Web frontend works. dev.buildbotics.com is the API for our project sharing Website and is unrelated.

The HTTP entrypoints can be found listed in Web.py. For example, to start the currently selected GCode program you would do a PUT to /api/start. You can upload GCode with a muli-part form PUT to /api/file/. It would be pretty easy to do this with the Python requests library.

For example, with curl:

Code: Select all

curl -X PUT -F gcode=@hello.nc http://bbctrl.local/api
curl -X PUT http://bbctrl.local/api/start
To get status information, you need to open a Web socket connection to /websocket or /sockjs and listen to the JSON messages that are sent across it. This code in CAMotics does exactly that using Qt: https://github.com/CauldronDevelopmentL ... trlAPI.cpp

We will document this API eventually. I've opened a new issue on GitHub to track this request: https://github.com/buildbotics/bbctrl-f ... issues/201

tdwebste
Posts: 6
Joined: Thu Jan 02, 2020 11:22 pm

Re: Command-line control

Post by tdwebste » Thu Apr 30, 2020 12:06 am

Also looking to control from a computer through SSH or http,

Is there a document or example to follow.

tdwebste
Posts: 6
Joined: Thu Jan 02, 2020 11:22 pm

Re: Command-line control

Post by tdwebste » Sat May 30, 2020 12:37 am

Tried

curl -X PUT -F gcode=@hello.nc http://bbctrl.local/api

hello.nc
F1600 (Feed speed)
G0 X59.25 Y5.85
G1 X61.68 Y6.7
G1 Y56.6
G1 X6.04
M2 (end program)



I get the following error.
curl -X PUT -F gcode=@hello.nc http://192.168.0.167/api
<html><title>405: Method Not Allowed</title><body>405: Method Not Allowed</body></html>

cilynx
Posts: 1
Joined: Sun Oct 31, 2021 2:49 pm

Re: Command-line control

Post by cilynx » Mon Nov 01, 2021 7:52 am

I have straightforward remote upload and job starting working in python here.

At this point, I'm trying to figure out how to poll job status. Looking at the source for the Onefinity WebUI, it loos like it should be part of the state object, but I can't figure out how to get that object. Looking at the handler definition takes us to the StateHandler which really looks like it wants a GET request, but it's not working for me. If I GET /api/state, I get a 404 (Not Found) back and if I try to PUT /api/state, I get 405 (Method Not Allowed).

Watching /api/log during a job, I can see some of the information that I want on Comm entries, but not on Web entries. The log doesn't have all of the info though -- for example, I see the state change to RUNNING in a hash keyed xx, but I don't see the state change back to READY when the job completes. There has to be a proper way to get the state as it's there in the WebUI, but I'm going cross-eyed sorting through the JS. In the meantime, I'll probably wind up polling the log and assuming the job is done when the log stops updating for a few poll intervals.

Post Reply