Skip to content

Use the package

This page is for an agent that uses the package for a user.

Terminal window
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.

  • 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.

List the ports. This does not open a port.

Terminal window
eskin ports

Read 100 frames and stop. The output goes to one line that updates.

Terminal window
eskin stream -n 100

Start the visualiser without a browser window. The command runs until it is stopped.

Terminal window
eskin viz --no-browser --http-port 8765

Read 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])
  • A frame has 48 rows and 48 columns. frame.values and frame.raw are flat tuples of 2304 integers in row-major order.
  • Values are counts in arbitrary units. They are not pressure.
  • frame.timestamp is time.time() on the computer. frame.seq starts at 1.
  • EskinReader() and find_port() raise RuntimeError when zero or more than one USB serial device is connected.
  • read_frame() raises TimeoutError after 1 second without data.
  • eskin stream and eskin viz exit with code 1 and a message on these errors.
  • GET /events on the visualiser gives Server-Sent Events with {"seq", "t", "rows", "cols", "v"}.
  • If no user is present, do not run eskin stream, eskin viz or EskinReader.calibrate(). Calibration is correct only when nothing touches the pad, and you cannot see the pad.
  • If eskin ports shows 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 default rotate=1.
  • Do not change baudrate.
  • Do not start eskin viz with --host 0.0.0.0 unless the user asks for it. The server has no login.