flexitac 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {flexitac-0.2.2/flexitac.egg-info → flexitac-0.3.0}/PKG-INFO +1 -1
  2. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/__init__.py +1 -1
  3. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/sensor.py +23 -0
  4. {flexitac-0.2.2 → flexitac-0.3.0/flexitac.egg-info}/PKG-INFO +1 -1
  5. {flexitac-0.2.2 → flexitac-0.3.0}/LICENSE +0 -0
  6. {flexitac-0.2.2 → flexitac-0.3.0}/README.md +0 -0
  7. {flexitac-0.2.2 → flexitac-0.3.0}/examples/__init__.py +0 -0
  8. {flexitac-0.2.2 → flexitac-0.3.0}/examples/stream_frames.py +0 -0
  9. {flexitac-0.2.2 → flexitac-0.3.0}/examples/visualize_heatmap.py +0 -0
  10. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/find_port.py +0 -0
  11. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/firmware/__init__.py +0 -0
  12. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/firmware/template.ino +0 -0
  13. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/flash.py +0 -0
  14. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/logging_utils.py +0 -0
  15. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac/py.typed +0 -0
  16. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac.egg-info/SOURCES.txt +0 -0
  17. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac.egg-info/dependency_links.txt +0 -0
  18. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac.egg-info/entry_points.txt +0 -0
  19. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac.egg-info/requires.txt +0 -0
  20. {flexitac-0.2.2 → flexitac-0.3.0}/flexitac.egg-info/top_level.txt +0 -0
  21. {flexitac-0.2.2 → flexitac-0.3.0}/pyproject.toml +0 -0
  22. {flexitac-0.2.2 → flexitac-0.3.0}/setup.cfg +0 -0
  23. {flexitac-0.2.2 → flexitac-0.3.0}/tests/test_find_port.py +0 -0
  24. {flexitac-0.2.2 → flexitac-0.3.0}/tests/test_flash.py +0 -0
  25. {flexitac-0.2.2 → flexitac-0.3.0}/tests/test_sensor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexitac
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python runtime and flashing tools for FlexiTac tactile sensors
5
5
  Author-email: Wesley Maa <wesley.maa@gmail.com>
6
6
  License-Expression: MIT
@@ -3,4 +3,4 @@
3
3
  from flexitac.sensor import FlexiTacFrame, FlexiTacSensor
4
4
 
5
5
  __all__ = ["FlexiTacFrame", "FlexiTacSensor"]
6
- __version__ = "0.2.2"
6
+ __version__ = "0.3.0"
@@ -40,7 +40,27 @@ class FlexiTacSensor:
40
40
  noise_scale: float = 30.0,
41
41
  init_frames: int = 30,
42
42
  read_timeout_s: float = 5.0,
43
+ baseline: NDArray[np.float32] | float | None = None,
43
44
  ) -> None:
45
+ """Initialize a FlexiTac sensor.
46
+
47
+ Args:
48
+ port: Serial device path (e.g. ``/dev/ttyUSB0``).
49
+ rows: Number of tactile rows (default 12).
50
+ cols: Number of tactile columns (default 32).
51
+ baud: Serial baud rate matching the flashed firmware (default 2_000_000).
52
+ threshold: Contact-detection threshold in ADC counts above baseline.
53
+ noise_scale: Divisor used to normalize readings below ``threshold``.
54
+ init_frames: Number of frames sampled during ``calibrate()`` (default 30).
55
+ Higher values give a more robust baseline at the cost of startup time.
56
+ read_timeout_s: Maximum time ``read()`` will wait for a full frame.
57
+ baseline: If provided, skips auto-calibration on first ``read()``. Pass a
58
+ ``(rows, cols)`` array of per-pixel baselines, or a scalar applied to
59
+ every pixel. Typical resting ADC values land around 10-40 for an
60
+ unloaded sensor, so a scalar like ``20.0`` is a reasonable default
61
+ when you can't afford the startup delay of a full calibration. For
62
+ accurate contact detection, prefer letting ``calibrate()`` run.
63
+ """
44
64
  self.port = port
45
65
  self.rows = rows
46
66
  self.cols = cols
@@ -56,6 +76,9 @@ class FlexiTacSensor:
56
76
  self._baseline: NDArray[np.float32] | None = None
57
77
  self._seq = 0
58
78
 
79
+ if baseline is not None:
80
+ self._baseline = np.broadcast_to(np.float32(baseline), (rows, cols)).astype(np.float32).copy()
81
+
59
82
  def open(self) -> FlexiTacSensor:
60
83
  """Open the serial port if not already open."""
61
84
  if self._serial is None or not self._serial.is_open:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexitac
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python runtime and flashing tools for FlexiTac tactile sensors
5
5
  Author-email: Wesley Maa <wesley.maa@gmail.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes