LIDAR Module

class lidar.Lidar

Returns the scan data captured by the Lidar.

get_num_samples()

Returns the number of samples in a full LIDAR scan.

Return type

int

Returns

The number of points collected in a complete scan.

Example:

scan = rc.lidar.get_samples()

# Access the sample directly behind the car
rear_distance = scan[rc.lidar.get_num_samples() // 2]
abstract get_samples()

Returns the current LIDAR scan as an array of distance measurements.

Return type

NDArray[720, float32]

Returns

An array of distance measurements in cm.

Note

Samples are in clockwise order, with the 0th sample directly in front of the car. Each sample is an equal angle appart.

Example:

# Access the most recent lidar scan.
scan = rc.lidar.get_samples()

# Get the distance of the measurement directly in front of the car
forward_distance = scan[0]
abstract get_samples_async()

Returns the current LIDAR scan without the car in “go” mode.

Return type

NDArray[720, float32]

Returns

An array of distance measurements in cm.

Note

Samples are in clockwise order, with the 0th sample directly in front of the car. Each sample is an equal angle appart.

Warning

This function breaks the start-update paradigm and should only be used in Jupyter Notebook.

Example:

# Access the most recent lidar scan.
scan = rc.lidar.get_samples_async()

# Get the distance of the measurement directly in front of the car
forward_distance = lidar_ranges[0]