High dynamic range (HDR)¶
With one fixed gain, a sensor either resolves light touch or measures heavy loads, not both: a gain high enough for a small weight saturates under a hand press. HDR removes that trade-off on the 60-pin readout board. Every taxel is first read at the highest gain. Taxels that saturate are read again at a lower gain in the same frame, and again at a lower one if they still saturate. Each taxel is therefore reported at the highest gain that does not saturate it, so light and heavy contacts on different parts of one sensor are measured at the same time.
Measured against a scale¶
On a 360-taxel skin resting on a scale (Figure 3), one fixed gain saturates 26 of the 45 taxels in contact under a 78 N press, and the force it reports levels off near 9 N. HDR re-reads those taxels at gains of 1/3 and 1/10 in the same frame and follows the scale up to 80 N, the largest load tested: above 20 N, the median ratio of its estimate to the scale is 1.04, against 0.13 at one fixed gain. With a 3.7 kg weight stack and a 20 g weight on opposite ends of the skin, HDR reads the stack at gains of 1 and 1/3 and the small weight at gain 1, in the same frame.
Enable HDR¶
HDR needs the 60-pin readout board and firmware with HDR (uv run opentac flash). It begins by measuring the zero at every gain it uses, which takes about 1 s; nothing may touch the sensor during that time.
uv run opentac view --hdr # h switches between HDR and one fixed gain; b zeroes again
uv run opentac view --hdr --xampling 128
uv run opentac record takes/ --hdr
from opentac.device import Sensor
s = Sensor()
s.hdr() # nothing touching: zero at every gain, then HDR on (HDR_GAINS 0x8421)
frame = s.read()
frame.taxels # counts above the zero, at the highest gain
frame.gain # the gain each taxel was read at, 1 to 1/148
s.hdr(False) # one fixed gain again, in raw counts
Beside the tactile map, the viewer shows a gain map: the gain each taxel was read at in the current frame, lower under a load and the highest everywhere else. In HDR the tactile map's colour scale is logarithmic, so a light touch and a heavy press appear on one scale.
HDR is off whenever a program opens the sensor, and closing the sensor turns it off, so programs that do not use HDR receive the same frames as before. A recording made in HDR keeps the values as the board sent them, together with the zero at every gain; opentac.record.hdr_counts(take) converts them.
How it works¶
The 60-pin board's gain switch sets the feedback resistance of the readout amplifier (see Gain). HDR uses five of its settings, each about three to four times lower in gain than the one before:
| Pass | GAIN_SW |
Feedback | Gain |
|---|---|---|---|
| 0 | 0 | 10 kΩ | 1 |
| 1 | 1 | 3.2 kΩ | 1/3 |
| 2 | 2 | 991 Ω | 1/10 |
| 3 | 4 | 263 Ω | 1/38 |
| 4 | 8 | 67.5 Ω | 1/148 |
Pass 0 is an ordinary raster scan at GAIN_SW (the highest gain by default). Each further pass switches to the next gain and re-reads only the taxels whose reading in the pass before reached HDR_CLIP. The passes stop when no taxel needs another one, and the gain is back at its starting value before the frame is sent. The host divides each reading, less the zero at its gain, by that gain, so every taxel is reported in the same units.
HDR_CLIP. (b) Value reported: HDR extends the measurable range by the ratio of the highest to the lowest gain, 148×, with full sensitivity kept at the low end.Settings¶
| Parameter | Default | Meaning |
|---|---|---|
HDR_GAINS |
0 (off) | one hexadecimal digit per re-read pass, lowest first: the GAIN_SW of that pass. 0x8421 re-reads at GAIN_SW 1, 2, 4 and 8 |
HDR_CLIP |
3800 | raw reading at or above which a taxel is read again in the next pass |
HDR is off at boot, so existing programs see no change. It works in raster scanning and in Xampling, where the passes re-read only the taxels sampled in that frame; Z ignores HDR_GAINS.
Frame format¶
A re-read value carries its pass in the top four bits of the 16-bit reading: value = raw + 4096 × pass. Readings from pass 0 are unchanged, so a frame with nothing saturated is identical to one read without HDR. Programs that read the protocol directly take value >> 12 as the pass and value & 0x0FFF as the raw reading. In an Xampling frame, values from pass 0 are counts above the board's zero, as without HDR, and a re-read value is the raw reading at its gain: the board keeps its zero at one gain only, so the host subtracts the zero it measured at that gain.
Frame time¶
HDR adds no time when no taxel reaches HDR_CLIP: on the 360-taxel skin of Figure 3, a raster frame takes 5.3 ms with HDR on or off, and an Xampling frame of 128 reads 2.4 ms. Each pass that has taxels to re-read adds a fixed 0.3–0.5 ms to switch the gain, and each re-read adds 15 µs, the same as reading one taxel in the raster scan. Re-reading 25 taxels over two passes, as under the 78 N press in Figure 3, adds 1.2 ms.
Limits¶
- 60-pin board only. The 30-pin board has no gain switch.
- Gain ratios. Readings are converted with the nominal feedback resistances, which agree with the measured ones to within 1 to 3%. A taxel whose load crosses from one gain to the next can therefore step by up to that amount.
- Saturation at the lowest gain. A taxel that reaches full scale at 1/148 is reported at full scale, as with one fixed gain.
