techninja / cncserver

A RESTful API server for driving serial based CNC devices
133 stars 39 forks source link

Feature suggestion: Add "canned" routines #66

Open oskay opened 8 years ago

oskay commented 8 years ago

As a possible time-and-buffer saving tool, it might be helpful to add certain canned routines-- tiny macros, so to speak, that might be able to perform some higher level functions within CNCserver.

Typical CNCserver commands are of the form (in pseudocode, not actual API operations):

These operations typically result in a motor movement, possibly with a subsequence of operations that are performed. For example, "get color1" will perform "pen up, move to position, pen down, wiggle, pen up", using a lookup table to find the required position. However, a considerable time and memory savings might be possible by adding some higher level commands. For example, a drawing that makes 10,000 circles would go much faster if it could send 10,000 command of the form "draw a circle" than if it had to specify the polygon segments that make up each circle.

I propose adding a new category of "canned" routines to handle things of this sort. It could perhaps have the command form PUT /v1/canned/{routinename}. These canned routines should be essentially independent of the tool being used, so that they can be used with any type of tool, in any context-- whether the pen is up or down, and whether it is a brush or a pencil.

Potential examples could include:

This new category may not be the best approach -- I am 100% open to alternate suggestions of better ways to approach this.

oskay commented 8 years ago

Adding the capability for CNCserver to handle these little canned routines might also make for more elegant handling of things like doing the wiggle while getting paint-- it could trace out neat spirals or ellipses in the paint dish instead.