scanner

class blickfeld_scanner.scanner.scanner(hostname_or_ip='localhost', port=None, timeout=30, name=None, key_and_cert_file=None, key_and_cert=None)

Scanner is a class to connect to a device, get a point cloud stream, get a status stream and set a scan pattern.

Parameters
  • hostname_or_ip (str) – Device to which the connection should be established.

  • port (int) – Port on which the device is reachable the default is 8000.

  • timeout (int) – Timeout in seconds until connection is aborted

  • name (str) – Name of the device used for string representation.

  • key_and_cert_file (str) – Filename containing a private key and certificate for SSL connection.

  • key_and_cert (str) – String containing a private key and certificate for SSL connection.

protocol_version = 1
hello()

Send hello to device and retrieve device, software, and hardware information

Returns

Hello object, see Protobuf definitions Response.Hello

serial_number()

> Introduced in BSL v2.16 and firmware v1.17

Retrieve unique serial number of the device. Consider using hello() to retrieve more information.

Returns

Unique serial number of the device

product()

> Introduced in BSL v2.16 and firmware v1.17

Retrieve product type. Consider using hello() to retrieve more information.

Returns

Product type of the device, see Protobuf definitions config.Product

get_status()

Request status of device

Returns

Status object, see Protobuf definitions Status

get_status_stream()

Request status stream of device

This returns a status stream, which only delivers updates when the device has changed. Do not use this in a synchronous blocking call. Use the get_status method instead.

Returns

blickfeld_scanner.scanner.stream.status object

get_point_cloud_stream(filter=None, reference_frame=None, point_filter=None, algorithms=None, as_numpy=False)

Request point cloud stream of device

Parameters
  • filter

    DEPRECATED

    > Introduced in BSL v2.10 and firmware v1.9

    Filter points and returns by point attributes during the post-processing on the device. Is replaced by ‘point_filter’.

  • reference_frame

    > Introduced in BSL v2.10 and firmware v1.9

    Frame representing the desired data. To request a field, set it to any value (also in submessages). For a repeated field, add at least one element.

  • point_filter

    > Introduced in BSL v2.13 and firmware v1.9

    Filter points and returns by point attributes during the post-processing on the device. This replaces the ‘filter’ parameter

  • algorithms

    > Introduced in BSL v2.17 and firmware v1.16

    Add set of algorithms which post-process the point cloud data.

  • as_numpy

    > Introduced in BSL v2.16

    This enables numpy support of the point cloud stream. Use recv_frame_as_numpy() to fetch frames as numpy structured arrays. Specify the required attributes via the reference_frame attribute.

    Note: With devices with an firmware version older than v1.17, the performance is significantly worse than with up-to-date devices as the format needs to be converted on the client side. Consider updating the device.

Returns

blickfeld_scanner.scanner.stream.point_cloud object

get_raw_point_cloud_stream(point_filter=None, reference_frame=None)

Request raw point cloud stream of device

> Introduced in BSL v2.13 and firmware v1.13

Parameters
  • point_filter

    > Introduced in BSL v2.10 and firmware v1.9

    Filter points and returns by point attributes during the post-processing on the device.

  • reference_frame

    > Introduced in BSL v2.10 and firmware v1.9

    Frame representing the desired data. To request a field, set it to any value (also in submessages). For a repeated field, add at least one element.

Returns

blickfeld_scanner.scanner.stream.raw object

record_point_cloud_stream(file_name, point_filter=None, reference_frame=None)

Record point cloud stream to file

> Introduced in BSL v2.13 and firmware v1.13

Parameters
  • file_name – Path to the file where it should be dumped

  • point_filter

    > Introduced in BSL v2.10 and firmware v1.9

    Filter points and returns by point attributes during the post-processing on the device.

  • reference_frame

    > Introduced in BSL v2.10 and firmware v1.9

    Frame representing the desired data. To request a field, set it to any value (also in submessages). For a repeated field, add at least one element.

Returns

blickfeld_scanner.scanner.stream.raw object

static file_point_cloud_stream(dump_filename, as_numpy=False)

Request a point_cloud_stream, which streams off a .bfpc file. No device (and connection to a device) is needed for this operation.

Parameters
  • dump_filename – path to .bfpc file

  • as_numpy

    > Introduced in BSL v2.16

    This enables numpy support of the point cloud stream. Use recv_frame_as_numpy() to fetch frames as numpy structured arrays. Specify the required attributes via the reference_frame attribute.

    Note: The performance of this option is significantly better with files that were recorded in the packed format. Packed recordings are available in firmware versions >= v1.17.

Returns

blickfeld_scanner.scanner.stream.point_cloud object

set_default_point_cloud_algorithms(persist=False, background_subtraction=False, neighbor_filter=False, static_transformation=False)

Sets point cloud algorithms, which are then applied on all point cloud stream subscribe requests of clients. Clients can still actively request other algorithms or disabled them.

Args:

persist (bool, optional): Persist the configuration on the device and activates it after a power-cycle. Defaults to False. background_subtraction (bool, optional): Either enable the background subtraction with default parameters or supply a configuration object. Defaults to False. neighbor_filter (bool, optional): Either enable the neighbor filter with default parameters or supply a configuration object Defaults to False. static_transformation (bool, optional): Either enable the static transformation with default parameters or supply a configuration object. Defaults to False.

Returns:

Currently set advanced config, see Protobuf definitions advanced config

set_scan_pattern(config=None, name=None, persist=False)

Function to set a new scan pattern, see: Protobuf definitions. First call blickfeld_scanner.scanner.scanner.fill_scan_pattern() with the scan pattern you want to set and then use that returned scan pattern as a config in this function.

> Changed in BSL v2.15 and firmware v1.16

It is now possible to set a named scan pattern. Either a scan pattern config or a name of a named scan pattern can be provided.

Parameters
  • config – scan pattern to be set

  • name – name of named scan pattern to be set

  • persist – Persist scan pattern on device and reload it after a power-cycle, see: Protobuf definitions scan pattern

Returns

response scan pattern, see Protobuf definitions Connection, see Protobuf definitions Connection

fill_scan_pattern(config)

Function to fill a scan pattern, see: Protobuf definitions. The device fill the missing fields with default values and return it. After it is filled the scan pattern can be set with the blickfeld_scanner.scanner.scanner.set_scan_pattern() function.

Parameters

config – scan pattern to be filled by the BSS, see: Protobuf definitions scan pattern

Returns

Filled scan pattern, which can be set, see Protobuf definitions scan pattern

get_scan_pattern()

Returns the currently set scan pattern, see: Protobuf definitions.

Returns

Currently set scan pattern, see Protobuf definitions scan pattern

get_scan_pattern_constraints()

This request returns a list of constraints which are applied on scan patterns.

> Introduced in BSL v2.14 and firmware v1.14

The constraints define the constant and dynamic relationships between field values. The constraints are equal for a device type and firmware, but might vary for firmware releases and device variants. It is mainly used to visualize the constraints in the scan pattern configuration of the web gui.

Returns

List of active constraints, see Protobuf definitions common

set_advanced_config(config, persist=False)

Function to set advanced config, see: Protobuf definitions. Expert parameters: It is not recommended to adapt this calibrated configuration without understanding the influences on the resulting point cloud quality.

> Introduced in BSL v2.11 and firmware v1.11

Parameters
  • config – advanced config to be set

  • persist – Persist advanced config on device and reload it after a power-cycle

Returns

response advanced config, see Protobuf definitions advanced config

get_advanced_config()

Returns the currently set advanced config, see: Protobuf definitions.

> Introduced in BSL v2.11 and firmware v1.11

Returns

Currently set advanced config, see Protobuf definitions advanced config

get_device_timestamp()

Returns the current device timestamp in seconds.

Returns

Current device timestamp in seconds

set_time_synchronization(ntp=False, ptp=False, persist=True, wait_for_sync=True, max_sync_duration=60)

> Introduced in BSL v2.18 and firmware v1.19

Set the type of time synchronization and set basic parameters

Either NTP or PTP has to be set (If both are set NTP will be choosen). It will overwrite the current time synchronization configuration

Parameters
  • ntp – Set this field to choose NTPv4 time synchronization, this can be a list of ntp servers or a bool if the standard config should be used

  • ptp – Set this field to choose PTP time synchronization, this can be a list of ptp unicast destinations, this will also activate unicast mode and deactivate multicast mode or a bool if the standard config should be used

  • persist – Persist time synchronization config on device and reload it after a power-cycle

  • wait_for_sync – Wait until device is synchronized. Raises exception if device is not synchronized within max_sync_duration.

  • max_sync_duration – Specify maximum time in seconds for synchronization.

Returns

None.

run_self_test()

> Introduced in BSL v2.10 and firmware v1.9

Run self test on the device. See Protobuf definitions Request.RunSelfTest.

Returns

Self test run response, see Protobuf definitions Response.RunSelfTest

create_connection()

Function to create a new connection

Returns

Newly created blickfeld_scanner.scanner.connection

attempt_error_recovery()

> Introduced in BSL v2.13 and firmware v1.13

This request can be used to attempt a re-initialization of the device if it is errored. A self test is automatically triggered after a successful re-initialization.

get_named_scan_patterns()

> Introduced in BSL v2.15 and firmware v1.16

Get protobuf list of named scan patterns. There are two types of named scan patterns: 1. Default scan patterns, which are not changeable. 2. User defined named scan patterns, which are changeable.

Returns

List of named scan patterns, see Protobuf definitions Response.GetNamedScanPatterns

store_named_scan_pattern(name, config)

> Introduced in BSL v2.15 and firmware v1.16

Store a named scan patterns. The default scan patterns can’t be overwritten.

Parameters
  • name – Name of the scan pattern

  • config – Config of the scan pattern, see Protobuf definitions ScanPattern

delete_named_scan_pattern(name)

> Introduced in BSL v2.15 and firmware v1.16

Delete a named scan patterns. The default scan patterns can’t be deleted.

Parameters

name – Name of the scan pattern

get_imu_stream(as_numpy=False)

> Introduced in BSL v2.18 and firmware v1.19

Request IMU stream of device

Returns

blickfeld_scanner.scanner.stream.imu object

static sync(devices, scan_pattern=None, target_frame_rate=None, max_time_difference=0.1)

Sync two or more devices to record frames at the same time.

Parameters
  • server (list of blickfeld_scanner.scanner.scanner) – list of scanners to sync

  • scan_pattern (scan pattern, see: Protobuf definitions,) – scan pattern that the devices should use, if None is given, it will select the current scan pattern

  • target_frame_rate (float) – Frame rate that the devices should run. Maximum frame rate is dependent on the scan pattern, if None is given the maximum possible frame rate will be used.

  • max_time_difference (float) – Maximum time difference allowed.

exception blickfeld_scanner.scanner.protocol_exception(value)

Protocol exception class for errors, see errors in Protobuf definitions

Parameters

value (Protocol Exception, see: Protobuf definitions) – Exception that occured

errno()

Returns error number

Returns

Error number

name()

Returns error name as in Protobuf definitions

Returns

Error name

description()

Returns error description as in Protobuf definitions

Returns

Error description

class blickfeld_scanner.scanner.connection(hostname_or_ip, port, timeout, key_and_cert=None, ssl_protocol=_SSLMethod.PROTOCOL_TLS)

Class to create a connection to the Blickfeld LiDAR device

Parameters
  • hostname_or_ip (str) – hostname or IP to which the connection should be established

  • port (int) – port on which the connection should be established

  • timeout (int) – Timeout in seconds until connection is aborted

  • key_and_cert (str) – String containing a private key and certificate for SSL connection

  • ssl_protocol (see ssl lib: ssl.PROTOCOL_…) – The protocol used for an SSL connection

clone(other_hostname_or_ip=None, other_port=None, other_key_and_cert=None)

Copies connection object.

Parameters
  • other_hostname_or_ip (str) – a different hostname or IP to use for the clone

  • port (other) – a different port to use for the clone

  • other_key_and_cert (str) – a different string containing a private key and certificate for the clone

send_request(req)

Send request to the device

Parameters

req (Request, see: Protobuf definitions) – Request to the device

Returns

Response of the device, see: Protobuf definitions

send(req)

Send request to the device

Parameters

req (Request, see: Protobuf definitions) – Request to the device

recv()

Receive response of the device

Returns

Response of the device, see: Protobuf definitions

close()

Close connection to the device