Lidar2DMatchScansGrid

class quanser.image_processing.lidar_match_scans.Lidar2DMatchScansGrid(resolution=20.0, max_range=5.0)

A Python wrapper for the Quanser LIDAR 2D Match Scans Grid API.

Parameters
  • resolution (float) – The resolution.

  • max_range (float) – The maximum range.

Raises

ImageProcessingError – On non-zero return code. A suitable error message may be retrieved using get_error_message.

Examples

Construct a new 2D LIDAR scan matcher.

>>> from quanser.image_processing import Lidar2DMatchScanGrid
>>> lidar2d_match_scan = Lidar2DMatchScanGrid()
>>> # ...
...
>>> lidar2d_match_scan.close()
close()

Closes the 2D LIDAR scan matcher and frees up resources allocated by the matcher. Scan matching can consume a significant amount of memory and system resources.

Raises

ImageProcessingError – On non-zero return code. A suitable error message may be retrieved using get_error_message.

Example

Close the 2D LIDAR scan matcher.

>>> from quanser.image_processing import Lidar2DMatchScanGrid
>>> resolution = 13.0
>>> max_range = 8.0
>>> lidar2d_match_scan = Lidar2DMatchScanGrid()
>>> lidar2d_match_scan.open(resolution, max_range)
>>> # ...
...
>>> lidar2d_match_scan.close()
match(ref_ranges, ref_angles, num_ref_points, ranges, angles, num_points, initial_pose, translation_search_range, rotation_search_range, pose, score, covariance)

Match the current scan to the reference scan, returning the pose of the current scan relative to the reference scan. If the score and/or covariance outputs are non-NULL then it will return the confidence in the match as a scalar score and/or 3x3 covariance matrix. For the fastest results, an initial pose may be specified, that may be derived from IMU data, for instance. In that case, if a translation search range and/or rotation search range is indicated then it will limit the search to those ranges.

If the translation_search_range is NULL then values of 4 meters will be used. If the rotation_search_range is zero then a search range of 2*PI will be used.

Parameters
  • ref_ranges (array_like) – A vector of range values for the reference scan.

  • ref_angles (array_like) – A vector of angles or heading values for the reference scan.

  • num_ref_points (int) – The number of valid points in reference scan as specified in the “ref_ranges” and “ref_angles” array.

  • ranges (array_like) – A vector of range values for the current scan.

  • angles (array_like) – A vector of angle or heading values for the current scan.

  • num_points (int) – The number of valid points in the current scan.

  • initial_pose (array_like) – The initial pose as a 3-vector at which to start the grid search. The “translation_search_range” and “rotation_search_range” are relative to this initial pose. The pose consists of the elements [x, y, theta] where x and y denote the translation in meters and theta denotes the rotation in radians.

  • translation_search_range (array_like) – The translation search range as a 2-vector [x,y] indicating the cartesian search range in meters.

  • rotation_search_range (float) – The rotation search range as a scalar indicating the angular search range in radians.

  • pose (array_like) – The pose as a 3-vector [x,y,theta] representing the transformation between the current scan and the reference scan. The (x,y) components are the translation and the theta component is the rotation.

  • score (array_like) – A score representing the confidence in the match. Higher values denote higher confidence. The value is not normalized so it is highly dependent on the input scans and block parameters.

  • covariance (array_like) – A 3x3 matrix representing an estimate of the covariance of the result. This output is currently set to zero but may be added in future revisions.

Raises

ImageProcessingError – On non-zero return code. A suitable error message may be retrieved using get_error_message.

Example

Read the 2D LIDAR scan matcher.

>>> from quanser.image_processing import Lidar2DMatchScanGrid
>>> resolution = 13.0
>>> max_range = 8.0
>>> lidar2d_match_scan = Lidar2DMatchScanGrid()
>>> lidar2d_match_scan.open(resolution, max_range)
>>> # ...
...#TODO: <to be filled in>
>>> lidar2d_match_scan.close()
open(max_range)

Opens a 2D LIDAR scan matcher.

Parameters
  • resolution (float) – The resolution.

  • max_range (float) – The maximum range.

Raises

ImageProcessingError – On non-zero return code. A suitable error message may be retrieved using get_error_message.

Examples

Open the 2D LIDAR scan matcher with 13 grid cells per meter and any LIDAR scan data beyond 8 metre to be discarded.

>>> from quanser.image_processing import Lidar2DMatchScanGrid
>>> resolution = 13.0
>>> max_range = 8.0
>>> lidar2d_match_scan = Lidar2DMatchScanGrid()
>>> lidar2d_match_scan.open(resolution, max_range)
>>> # ...
...
>>> lidar2d_match_scan.close()