Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature suggestion: Add "canned" routines #66

Open
oskay opened this issue Nov 18, 2015 · 1 comment
Open

Feature suggestion: Add "canned" routines #66

oskay opened this issue Nov 18, 2015 · 1 comment

Comments

@oskay
Copy link
Collaborator

oskay commented Nov 18, 2015

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):

  • pen: Go to (x,y)
  • pen: down
  • tool: get water
  • tool: get color1

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:

  • circle(radius) -- draw a circle, centered at the pen's current (x,y) value, with the given radius. A potential challenge is in determining the number of vertices/segments that should be used to draw the circle. It could default (say) to 3 + floor(radius/5), or some other "reasonable" formula. It could also use a minimum/maximum segment length specified some other way, perhaps as part of the tool specification ("typical segment length for canned routines").
  • circle(radius, number of vertices) -- to explicitly set the number of vertices
  • ellipse(axis1, axis2). Draw an ellipse, centered at the pen's current (x,y) value. The axes are distances (either could be the major or minor axis).
  • ellipse(axis1, axis2, angle), where the axes are distances, and the angle is specified between the X axis and the ellipse to be drawn
  • rectangle(length1,length2)
  • etc (arcs? filled rectangles? spirals?)

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

@oskay
Copy link
Collaborator Author

oskay commented Nov 18, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant