Skip to content

Conversation

@sterlinghirsh
Copy link
Contributor

This changes the structure of drawing shapes a bit so that instead of just receiving a resolution, Shape.draw() accepts a SceneOptions object, which contains resolution, fps, blankingPoints, maxWaitPoints. This replaces the constants RESOLUTION, BLANKING_AMOUNT, and MAX_WAIT_AMOUNT and lets us update the values without restarting the program.

This change adds a calibration interface (examples/calibration). This lets you update parameters like pps, resolution, blanking points, and max wait points in real time from a web UI. The UI also displays stats and performance output. For example:

{
  "devices": {
    "Simulator": {},
    "Helios": {
      "calculated": {
        "duration": 547.624,
        "successPps": 13412,
        "attemptedPps": 13428,
        "successPpsPercentOfNominal": 53.648,
        "attemptedPpsPercentOfNominal": 53.712,
        "avgFramePoints": 448,
        "avgFrameDisplayMs": 18,
        "avgFrameAllotmentUtilization": 53.78151260504202,
        "avgFrameDeviceLimitUtilization": 10.942843185148998,
        "notReadyFramePercent": 0
      },
      "startTime": 1611021814277,
      "secondsPerPoint": 0.00004,
      "msPerPoint": 0.04,
      "microsecondsPerPoint": 40,
      "maxTheoreticalAccel": 1250,
      "fixedFrameRate": {
        "fps": 30,
        "allottedFrameMs": 33,
        "allottedFramePoints": 833,
        "frameAllotmentPercentOfDeviceLimit": 20.34684904738642
      },
      "points": {
        "Success": 7344513,
        "Not Ready": 0,
        "Fail": 9205,
        "Empty": 0
      },
      "frames": {
        "Success": 16398,
        "Not Ready": 0,
        "Fail": 20,
        "Empty": 0
      },
      "lastFrame": {
        "points": 433,
        "result": "Success",
        "drawMs": 17.32,
        "maxJumpX": 0.75,
        "maxJumpY": 0.5,
        "maxJump": 0.75,
        "maxSpeed": 18750,
        "maxAccel": 468.75
      },
      "allFrames": {
        "maxJumpX": 0.75,
        "maxJumpY": 0.5,
        "maxJump": 0.75,
        "maxSpeed": 18750,
        "maxAccel": 468.75
      }
    }
  }
}

Further work:

  • Build a nicer react-based UI
  • Persist the calibration settings
  • Allow setting dwell and blanking by time instead of by points

My laser (via helios) would stay on when I'd shut down the program,
so I added a shutdown handler for safety and convenience.

I didn't add it for any other devices since I don't have any to test,
but it should be a simple change to add it.
This lets us load the package for unsupported devices without crashing.

There are probably more incompatibilities, but the windows DACs were the
ones causing a problem for me.
There's some other problems with this example but those changes will come later.
This was causing a typescript issue for me because
ilda-reader and draw both use a Point interface.
They're different but they both overlap on r, g,
and b, which is all we care about.
It was off by one, so you could get an out-of-bounds value. This immediately
fixed at least one example that draws a bounding box.
This was flipping both X and Y, but only Y needed to be flipped.

This became apparent when using the svg-path example when the
text was backwards.
This makes the animation a bit less jerky by using the actual time
since the last frame to determine movement.
They're called balls, might as well use a Circle.
Add transformer to convert all points to monochrome
It's a bit simpler since these functions are just mapping a function on points.
Add makeTransformer() and use with clamp and monochrome
It's a little more clear that it will take a Point from core and turn it into a helios point.
I'm not able to achieve the expected pps on my device. I think it's
because writing in small chunks has more overhead.
Nothing has changed yet, but this will make the diff easier to read
Get rid of the old stuff and and add the new stuff.

It will talk to a webpage with a websocket and change settings in real time.
This lets us show stats and sync settings both ways.
It's a bit redundant since we're displaying them through the web UI
This is stuff like max speed and acceleration for each frame for all time.
It wasn't that useful to have stats assume we're starting from the middle
since it would always cause a big acceleration spike at the start.
This will let us pass more parameters to shapes as we draw.
This allows blankingAmount and maxWaitAmount to be changed.
@sterlinghirsh
Copy link
Contributor Author

I realize this is a big change, since I think this is the full diff from my fork. Feel free to leave feedback if you feel like it, though I understand if you don't have time to work on this project for now.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant