Set the scan pattern
The ScanPattern service sets the field of view, the number of scanlines and the angle spacing, that is the density of the points on a scanline. To choose a scan pattern and set it in the WebGUI, see Choose a scan pattern.
The examples use the Python library and sign in with an application key. Replace qb2-xxxxxxxxx with the hostname or IP address of your sensor and application-key-for-qb2-xxxxxxxxx with the secret of your key.
Set the scan pattern
The method Set applies a scan pattern. The example sets a vertical field of view of 50°, 36 scanlines each up and down and a horizontal angle spacing of 0.5°.
| The scan pattern decides the maximum frame rate of the point cloud stream. |
import blickfeld_qb2
import math
scan_pattern = blickfeld_qb2.system.config.ScanPattern()
# Mirrors configuration for scan pattern trajectories
scan_pattern.vertical.field_of_view = 50 / 180 * math.pi
scan_pattern.vertical.scanlines_down = 36
scan_pattern.vertical.scanlines_up = 36
# Horizontal angle spacing for scanlines
scan_pattern.pulse.angle_spacing = 0.5 / 180 * math.pi
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
# Set scan pattern
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
service.set(scan_pattern=scan_pattern)
Store a scan pattern
The method Store stores the scan pattern on the sensor under a name without applying it, to apply it later over the API, see Apply a stored scan pattern, or in the WebGUI. The example continues the one above and stores its scan_pattern.
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
service.store(name="TestScanPattern", scan_pattern=scan_pattern)
Get the active scan pattern
The method Get returns the scan pattern the sensor runs.
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
response = service.get()
print(response)
Output after the examples above, one field per line:
ScanPatternGetResponse(
name='',
scan_pattern=ScanPattern(
vertical=ScanPatternVertical(field_of_view=0.8726646304130554, scanlines_up=36, scanlines_down=36),
pulse=ScanPatternPulse(angle_spacing=0.008726646192371845),
frame_rate=ScanPatternFrameRate(maximum=7.431110858917236, actual=7.431110858917236)
)
)
List the stored scan patterns
The method List returns the stored scan patterns.
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
response = service.list()
print(response)
Output after the examples above, one field per line:
ScanPatternListResponse(
named_scan_patterns={
'TestScanPattern': ScanPattern(
vertical=ScanPatternVertical(field_of_view=0.8726646304130554, scanlines_up=36, scanlines_down=36),
pulse=ScanPatternPulse(angle_spacing=0.008726646192371845),
frame_rate=ScanPatternFrameRate(maximum=7.431110858917236, actual=7.431110858917236)
)
}
)
Apply a stored scan pattern
The method Set also applies a stored scan pattern by its name. The example applies the scan pattern stored above.
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
service.set(name="TestScanPattern")
Delete a stored scan pattern
The method Delete removes a stored scan pattern. The example removes the one stored above. The scan pattern the sensor runs stays unchanged: as the example above applied the deleted one, get still returns its name, although no stored scan pattern has that name any more.
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.ScanPattern(channel)
service.delete(name="TestScanPattern")