Coder Social home page Coder Social logo

storborg / axibot Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 8.0 539 KB

Headless control software for the AxiDraw pen plotter.

Home Page: http://axibot.readthedocs.io/

License: GNU General Public License v2.0

Python 91.96% CSS 2.01% JavaScript 4.52% HTML 1.52%

axibot's People

Contributors

pwicks86 avatar storborg avatar tkornack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axibot's Issues

Try acceleration optimization based on axes

It should be possible to accelerate faster in the Y direction (where the axis has better support) than in the X direction. Try playing with an optimization where the angle of a line segment determines the max acceleration that can be used: where a perfectly horizontal line uses the existing acceleration parameters, but gradually increases to a 2x or so acceleration multiplier for a perfectly vertical line.

Include initial server SVG in package

Right now the server fails to start if axibot is installed in non-dev mode, because the examples directory is lost, and thus the default SVG cannot be loaded. Fix that, and maybe also switch to an example SVG which includes some basic "axibot" text or something.

Solve state race conditions with multiple users

An example case:

  • User A and B both load the page.
  • User A starts plotting.
  • Before their browser is notified of the state change, User B uploads a new document.
  • User B's upload throws an exception.

One way to deal with this is just to properly return error messages when actions fail.

USB ID String comparison failing due to case issues

Bug

The test for the USB ID string is case insensitive, and expects that the USB ID is uppercase. My AxiDraw string has lowercase letters and therefore the board is never found. Changing ebb.py to match my string 'USB VID:PID=04d8:fd92' allows the board to be found, and I can print with no issues.

SVG File

This issue is NOT SVG dependent

Your Environment

  • Axibot version (git sha1 hash): latest, built from master
  • Axidraw version (1,2 or 3): version 3
  • Eibotboard version: (it is relatively new, I've not removed the cover to see the version)
  • Operating System and version: Raspberry Pi Rasbian latest (fresh download)
  • Python version: 2.7

Fix pen visualization jank

When the robot does a long-duration move, the web interface doesn't update the state of the pen visualization during the move. This causes jankiness when traversing long line segments.

Unexpected EOF when pressing enter to begin plot

Bug

User presses enter to begin a plot, this error is displayed

Press enter to begin.
Traceback (most recent call last):
File "/usr/local/bin/axibot", line 9, in
load_entry_point('axibot==0.0.2', 'console_scripts', 'axibot')()
File "/usr/local/lib/python2.7/dist-packages/axibot/cmd.py", line 180, in main
return opts.function(opts)
File "/usr/local/lib/python2.7/dist-packages/axibot/cmd.py", line 123, in plot
input("Press enter to begin.")
File "", line 0

^

SyntaxError: unexpected EOF while parsing

Note, changing input("Press enter to begin.") to raw_input allows me to plot with no issues

SVG File

Issue is NOT SVG dependent

Your Environment

  • Axibot version (git sha1 hash): latest from master
  • Axidraw version (1,2 or 3): 3
  • Eibotboard version: Recent, but haven't verified; firmware 2.5.1
  • Operating System and version: Latest Raspbian (fresh download)
  • Python version:2.7

Auto-scaling fails

Looks like a floating point error.

WARNING:axibot.svg:This document does not specify physical units. Auto-scaling it to fit the drawing area.
AssertionError: SVG width of 11.000000000000002 must be <= 11
'''

Using python 3.6 / macOS 10.12.2 .

Webserver non-functional when installed via pip install

Bug

Webserver is non-functional when installed via pip install.

Your Environment

  • Axibot version (git sha1 hash): Installed from pip install
  • Axidraw version (1,2 or 3): Unrelated
  • Eibotboard version: Unrelated
  • Operating System and version: Raspbian (???)
  • Python version: 3.7

Implement a file format for axibot jobs

It should be possible to plan a job based on an SVG document, then execute that plan directly.

This feature is particularly leverage when bulk-planning and manipulating a large set of files, where it might take an inordinately long time to do things like parse and compute ink usage, time duration, etc.

Add a file format like foo.axibot.json which stores a list of actions and can be serialized/deserialized. The JSON file can also include the original source document (in cases where an SVG document was used to generate it) so that the document can be used as a preview in the server. This could also make various debug tools simpler/cleaner.

Set maximum speed

With my ballpoint pen, most curved lines plot nicely but long lines go too fast and are not well inked. Is there a way to set a maximum speed (perhaps for lengths greater than a few mm)?

Problem Polygon

This polygon doesn't work for me:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="62px" height="57px" viewBox="0 0 62 57" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
    <title>Shape</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Twinleaf-Logo-Outline" transform="translate(-226.000000, -27.000000)" stroke="#000000">
            <g id="Group" transform="translate(13.000000, 27.000000)">
                <polygon id="Shape" points="241.589318 0.449723582 214.07791 55.8112177 243.210983 42.7635265 273.510516 54.7168952"></polygon>
            </g>
        </g>
    </g>
</svg>

The error is:

  File "/usr/local/lib/python3.6/site-packages/axibot-0.0.3.dev0-py3.6.egg/axibot/svg.py", line 145, in convert_to_path
    return points_to_path_string(node.get('points'), closed=True)
  File "/usr/local/lib/python3.6/site-packages/axibot-0.0.3.dev0-py3.6.egg/axibot/svg.py", line 109, in points_to_path_string
    xs, ys = point_string.split(',')
ValueError: not enough values to unpack (expected 2, got 1)

Polygon support

In my design software (Sketch for macOS) certain shapes are output to SVG as polygons. Any idea how hard it is to translate them to paths?

Figure out how to handle pausing/resuming plotting

It's unwise to pause plotting at a particular action, because that may result in extreme instantaneous acceleration/deceleration. Possible alternatives when pausing include:

  • Finish the entire current path, and then return to the origin. This relatively straightforward to implement and makes it easy to resume without any disturbance in the pen's line. This is probably the preferred solution.
  • Calculate a new trajectory which slows down as quickly as possible while still following the existing path, then lift and return to the origin. This is quite complex to implement, and may result in a disturbance when resuming to the same position, but does allow the fastest pauses.

We could also take a different approach when cancelling directly from plotting (without pausing first): Calculate a new spline trajectory from the current position and velocity back to the origin as quickly as possible. Then, execute that trajectory and lift the pen up at the same time.

Add a better story for API-based control

This could look like an AxiBot class with a higher-level interface for control. Something like:

path = svg.path.Path(...)
bot = AxiBot.connect()
bot.plot_path(path)

To test/demonstrate this, write a "clock" example which draws the current time as an analog clock once a minute or so.

px units

My drawing program (Sketch for macOS) decided to output SVG with px units.

1px = 1/96 in

It's a trivial thing to fix. I'll submit a pull request.

"ValueError" on all .svg plot||info attempts

Bug

When I try to plot an .svg file or get info on an .svg, I get the following error:

> axibot info lines.svg
Loading lines.svg...
Extracting paths...
Traceback (most recent call last):
File "c:\users...\appdata\local\programs\python\python35\lib\runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "c:\users...\appdata\local\programs\python\python35\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users...\AppData\Local\Programs\Python\Python35\Scripts\axibot.exe_main
.py", line 9, in
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\cmd.py", line 180, in main
return opts.function(opts)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\cmd.py", line 95, in info
actions = file_to_actions(opts.filename, pen_up_delay, pen_down_delay)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\cmd.py", line 48, in file_to_actions
paths = svg.extract_paths(filename)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\svg.py", line 247, in extract_paths
recurse_tree(paths, root, matrix)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\svg.py", line 212, in recurse_tree
recurse_tree(paths, node, matrix_new, parent_visibility=v)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\svg.py", line 216, in recurse_tree
paths.append(transform_path(node.get('d'), matrix_new))
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\svg.py", line 188, in transform_path
transform.apply(p, transform_matrix)
File "c:\users...\appdata\local\programs\python\python35\lib\site-packages\axibot\transform.py", line 203, in apply
raise ValueError("Don't know how to transform %r" % piece)
ValueError: Don't know how to transform Move(to=(394.96965+438.69448j))

SVG File

All .svg files tested so far (some created by me in inkscape, others from the example folder).
For this issue I'll focus on "lines.svg" from the examples folder.

Your Environment

Windows 10 and rasian linux. Same error on all attempts (with different "to" coordinates).

  • Axibot version (git sha1 hash): 66f5f7ee6713a6b0ec438608272e54c75ef66b8b
  • Axidraw version (1,2 or 3): 3
  • Eibotboard version:
  • Operating System and version: Windows 10, and Raspian Linux
  • Python version: 3.6.3 (raspian), and 3.5.2 (windows)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.