MTILidar API Reference

Classes

MTILidar

class mtilidar::MTILidar

CREATION AND TERMINATION

Constructor and Destructor of MTILidar instances

MTILidar *CreateLidar(int lidarType = LIDAR_TYPE_SYMPL1)

Create an instance of MTILidar.

void DeleteLidar(MTILidar *lidar)

Delete a previously instantiated instance of MTILidar.

CONNECTION AND DISCONNECTION

Open the COM port and connect and disconnect to the Lidar device.

void ConnectLidar(const std::string &portName) = 0

Opens the COM port and connects to the addressed Lidar device.

void ConnectLidar() = 0

Opens the first available Lidar serial device and connects to it.

void DisconnectLidar() = 0

Stops communication with the Lidar and closes the COM port.

PARAMETERS

Methods for getting and setting Lidar parameters, scanning parameters, and data processing parameters

LidarParameters GetLidarParameters() = 0

Gets all LidarParameters from the Lidar device.

void SetRasterParameters(const RasterParameters &rasterParameters) = 0

Set the raster pattern variables.

RasterParameters GetRasterParameters() = 0

Get the raster pattern variables.

void GenerateAndLoadRaster(const RasterParameters &rasterParameters) = 0

Generate and load raster pattern.

void GenerateAndLoadRaster() = 0

Overload without arguments uses the raster parameters that were previously set with SetRasterParameters()

void SetDataProcessingParameters(const DataProcessingParameters &dataProcessingParameters) = 0

Data processing parameters are used to set the type of post-processing done on the point cloud Post-processing will be automatically done on all incoming data from the Lidar device according to the parameters set by this command.

DataProcessingParameters GetDataProcessingParameters() = 0

Returns the DataProcessingParameters that are being used to process incoming data from the Lidar device

OPERATION

Methods involved in operating the Lidar device

void StartLidar() = 0

Start the operation of the Lidar device.

void StopLidar() = 0

Stop the operation of the Lidar device.

void GetFrame(std::vector<PointXYZ> &pointsXYZ, int timeoutMs) = 0

Gets the most recent frame of 3D points that was scanned and returns the frame as described in Cartesian coordinates. See: PointXYZ If timoutMs=0, immediately returns if data is not available.

void GetFrame(std::vector<PointSphere> &pointsSphere, int timeoutMs) = 0

Gets the most recent frame of 3D points that was scanned and returns the frame as described in spherical coordinates. See: PointSphere If timoutMs=0, immediately returns if data is not available.

POINT AND RANGE

Methods for pointing and ranging

void GoToPosition(float x, float y) = 0

Direct the Lidar to point to a coordinate in X/Y format.

float GetDistance() = 0

Used in concert with GoToPosition Returns a distance for the Lidar’s current positional displacement

POINT CONVERSION

Methods for converting points

void PointsXYZtoSphere(const std::vector<PointXYZ> &pointsXYZ, std::vector<PointSphere> &pointsSphere)

Convert vector of XYZ points into a vector of spherical points.

void PointsSpheretoXYZ(const std::vector<PointSphere> &pointsSphere, std::vector<PointXYZ> &pointsXYZ)

Convert vector of spherical points into a vector of XYZ points.

STATUS

Methods for querying Lidar device and MTILidar instance status

MTILidarError GetLastError()
bool HasError()

Structs

DataProcessingParameters

struct mtilidar::DataProcessingParameters

Public Members

OutlierHandling outlierHandling = OutlierHandling::INTERPOLATE
bool smoothingFilterEnabled = true
int smoothingFilterBandwidthHz = 3000
bool integrationEnabled = false
float integrationFactor = 0.7f
bool cropDataEnabled = true
float cropDataRangeMin = 0.0f
float cropDataRangeMax = 0.0f
int dataAlignmentAdjustment = 0

LidarParameters

struct mtilidar::LidarParameters

Parameters to be used in the construction of a raster scanning pattern.

Public Members

std::string lidarName
std::string firmwareName
float axisAngleMax
int rangeLimit
int sampleRate

PointSphere

struct mtilidar::PointSphere

Describes the type of waveform to be used for the generated scan pattern’s “fast axis”.

Public Members

float radius
float azimuth
float elevation

PointXYZ

struct mtilidar::PointXYZ

< A point in 3D space, described in Cartesian coordinates

A point in 3D space, described in a spherical coordinate system More information: https://en.wikipedia.org/wiki/Spherical_coordinate_system

Public Members

float x
float y
float z

RasterParameters

struct mtilidar::RasterParameters

Parameters used by ProcessData.

Public Members

int numLines = 20
float lineDuration = 0.01f
float xAmplitude = 1.0f
float yAmplitude = 1.0f
float xOffset = 0.0f
float yOffset = 0.0f
FastAxisType fastAxis = FastAxisType::SINUSOIDAL

Enums

FastAxisType

enum mtilidar::FastAxisType

Values:

enumerator SINUSOIDAL
enumerator TRIANGULAR

LidarTypes

enumerator LIDAR_TYPE_STUB
enumerator LIDAR_TYPE_SYMPL1