|
AndyMark FRC CAN API (C++) v2026.0.4
|
ToF/Lidar sensor device. More...
#include <AM_CAN_Lidar.h>
Public Member Functions | |
| AM_CANLidar (int deviceID) | |
| Construct a CAN lidar sensor with the given CAN ID. | |
| AM_LidarData | GetData () |
| Fetch the most recent lidar reading using the default timeout. | |
| AM_LidarData | GetData (int timeoutMs) |
| Fetch lidar reading with a custom timeout applied to the CAN read. | |
| AM_LidarDebugData | GetDebugData (int timeoutMs=50) |
| Retrieve the latest debug information from the sensor. | |
| uint16_t | GetPeakSignalCentiMcps () const |
| Get the peak signal strength of the last debug sample. | |
| uint16_t | GetAmbientCentiMcps () const |
| Get the ambient light level of the last debug sample. | |
| bool | HasDebugData () const |
| Returns true if at least one debug frame has been received. | |
| bool | SetDistanceMode (AM_LidarDistanceMode mode) |
| Set the VL53L1X distance mode on the device. | |
| bool | SetMeasurementTimingBudgetUs (uint32_t budgetUs) |
| Set measurement timing budget on the device. | |
| bool | SetIntermeasurementPeriodMs (uint32_t periodMs) |
| Set intermeasurement period on the device. | |
| bool | SetTimeoutMs (uint16_t timeoutMs) |
| Set the lidar library read timeout on the device. | |
| bool | SetSigmaThreshold (uint16_t sigma) |
| Set the VL53L1X sigma threshold register value. | |
| bool | SetMinSignalRate (float mcps) |
| Set the minimum signal rate threshold on the device. | |
| bool | SetROISize (uint8_t width, uint8_t height) |
| Set the ROI size on the device. | |
| bool | SetROICenter (uint8_t centerSpad) |
| Set the ROI center SPAD on the device. | |
| void | SetUserOffsetMm (int32_t offsetMm) |
| Set an additional runtime offset applied on top of the default offset. | |
| int32_t | GetUserOffsetMm () const |
| Get the currently configured runtime (user) offset in millimeters. | |
| void | SetOffsetDegrees (double degrees) |
| void | SetReportPeriod (int periodMs) |
| Set periodic report period (ms) for device reports. | |
| void | ResetReportPeriod () |
| Reset device report period to default (50ms). | |
| Public Member Functions inherited from CanDevice | |
| CanDevice (int deviceID, int deviceManufacturer, int deviceType) | |
| Construct a CAN device wrapper. | |
| virtual | ~CanDevice ()=default |
| Virtual destructor. | |
| int | getDeviceId () |
| Get this device's configured CAN ID. | |
| void | RestartDevice () |
| Request a device reboot via CAN command. | |
Static Public Member Functions | |
| static constexpr int32_t | GetDefaultOffsetMm () |
| Get the fixed default offset in millimeters compiled into the library. | |
Public Attributes | |
| AM_LidarData | data |
Additional Inherited Members | |
| Protected Member Functions inherited from CanDevice | |
| void | SendCANMessage (int apiID, const uint8_t *data, int length) |
| Low-level helper to transmit a CAN packet. | |
| bool | ReceiveCANMessage (int apiID, frc::CANData *, int timeoutMs) |
| Receive a packet with a specific API ID, optionally waiting up to timeout. | |
| Protected Attributes inherited from CanDevice | |
| frc::CAN | m_can |
| int | m_deviceID |
| int | deviceManufacturer |
| int | deviceType |
ToF/Lidar sensor device.
Retrieves distance, status, flags, timestamp, and optional debug signal data from the device over CAN.
Offsets:
Positive offsets increase reported distance, negative offsets decrease it.
|
explicit |
Construct a CAN lidar sensor with the given CAN ID.
| deviceID | The device's CAN ID. |
| uint16_t AM_CANLidar::GetAmbientCentiMcps | ( | ) | const |
Get the ambient light level of the last debug sample.
| AM_LidarData AM_CANLidar::GetData | ( | ) |
Fetch the most recent lidar reading using the default timeout.
| AM_LidarData AM_CANLidar::GetData | ( | int | timeoutMs | ) |
Fetch lidar reading with a custom timeout applied to the CAN read.
| timeoutMs | Timeout in milliseconds for the CAN read. |
| AM_LidarDebugData AM_CANLidar::GetDebugData | ( | int | timeoutMs = 50 | ) |
Retrieve the latest debug information from the sensor.
Attempts to read a debug CAN frame. If a new frame is not available within the timeout, the most recently cached debug data is returned instead.
| timeoutMs | Timeout for the CAN read. |
|
inlinestaticconstexpr |
Get the fixed default offset in millimeters compiled into the library.
| uint16_t AM_CANLidar::GetPeakSignalCentiMcps | ( | ) | const |
Get the peak signal strength of the last debug sample.
| int32_t AM_CANLidar::GetUserOffsetMm | ( | ) | const |
Get the currently configured runtime (user) offset in millimeters.
| bool AM_CANLidar::HasDebugData | ( | ) | const |
Returns true if at least one debug frame has been received.
| void AM_CANLidar::ResetReportPeriod | ( | ) |
Reset device report period to default (50ms).
| bool AM_CANLidar::SetDistanceMode | ( | AM_LidarDistanceMode | mode | ) |
Set the VL53L1X distance mode on the device.
| mode | Distance mode value to send to the device firmware. |
| bool AM_CANLidar::SetIntermeasurementPeriodMs | ( | uint32_t | periodMs | ) |
Set intermeasurement period on the device.
| periodMs | Period in milliseconds. |
| bool AM_CANLidar::SetMeasurementTimingBudgetUs | ( | uint32_t | budgetUs | ) |
Set measurement timing budget on the device.
| budgetUs | Timing budget in microseconds. |
| bool AM_CANLidar::SetMinSignalRate | ( | float | mcps | ) |
Set the minimum signal rate threshold on the device.
Units are MCPS.
| mcps | Minimum signal rate in MCPS. |
| void AM_CANLidar::SetOffsetDegrees | ( | double | degrees | ) |
| void AM_CANLidar::SetReportPeriod | ( | int | periodMs | ) |
Set periodic report period (ms) for device reports.
| periodMs | Period in milliseconds. |
| bool AM_CANLidar::SetROICenter | ( | uint8_t | centerSpad | ) |
Set the ROI center SPAD on the device.
| centerSpad | SPAD number to use as ROI center. |
| bool AM_CANLidar::SetROISize | ( | uint8_t | width, |
| uint8_t | height ) |
Set the ROI size on the device.
| width | ROI width in SPADs. |
| height | ROI height in SPADs. |
| bool AM_CANLidar::SetSigmaThreshold | ( | uint16_t | sigma | ) |
Set the VL53L1X sigma threshold register value.
| sigma | Raw sigma threshold register value. |
| bool AM_CANLidar::SetTimeoutMs | ( | uint16_t | timeoutMs | ) |
Set the lidar library read timeout on the device.
| timeoutMs | Timeout in milliseconds. |
| void AM_CANLidar::SetUserOffsetMm | ( | int32_t | offsetMm | ) |
Set an additional runtime offset applied on top of the default offset.
| offsetMm | Additional offset in millimeters. |
Total offset applied to returned readings is:
AM_LIDAR_DEFAULT_OFFSET_MM + offsetMm
| AM_LidarData AM_CANLidar::data |
Last received data cached in the object (distance includes offsets).