Use the package
This page is for an agent that uses the package for a user.
Install
Section titled “Install”python3 -m pip install eskin # add "eskin[numpy]" for Frame.as_array()The package needs Python 3.10 or later. It installs the command eskin.
Entry points
Section titled “Entry points”- Command:
eskin ports,eskin stream,eskin viz. - Python:
from eskin import EskinReader, Frame, FrameParser, find_port, list_candidate_ports. - Visualiser from Python:
from eskin.viz import serve.
Common calls
Section titled “Common calls”List the ports. This does not open a port.
eskin portsRead 100 frames and stop. The output goes to one line that updates.
eskin stream -n 100Start the visualiser without a browser window. The command runs until it is stopped.
eskin viz --no-browser --http-port 8765Read one frame in Python.
from eskin import EskinReader
with EskinReader() as reader: reader.calibrate() frame = reader.read_frame() print(frame.max(), frame.grid()[0][:8])Inputs and outputs
Section titled “Inputs and outputs”- A frame has 48 rows and 48 columns.
frame.valuesandframe.raware flat tuples of 2304 integers in row-major order. - Values are counts in arbitrary units. They are not pressure.
frame.timestampistime.time()on the computer.frame.seqstarts at 1.EskinReader()andfind_port()raiseRuntimeErrorwhen zero or more than one USB serial device is connected.read_frame()raisesTimeoutErrorafter 1 second without data.eskin streamandeskin vizexit with code 1 and a message on these errors.GET /eventson the visualiser gives Server-Sent Events with{"seq", "t", "rows", "cols", "v"}.
Limits
Section titled “Limits”- If no user is present, do not run
eskin stream,eskin vizorEskinReader.calibrate(). Calibration is correct only when nothing touches the pad, and you cannot see the pad. - If
eskin portsshows more than one port, ask the user which port is the sensor. Do not open ports to find out. - If the user wants pressure in physical units, say that the package gives counts that are not calibrated.
- If the user wants to record data, write the frames to a file in the user’s project with the Python API. The package has no record command.
- If a second program must read the sensor, stop the first program first. One port has one reader.
- If the user uses the 190 mm pad, set
rotate=0. If the user uses the 20 mm pad, keep the defaultrotate=1. - Do not change
baudrate. - Do not start
eskin vizwith--host 0.0.0.0unless the user asks for it. The server has no login.