Overview¶
The Cepton SDK provides the following features:
Networking: Listen for sensor packets.
Capture Replay: Read sensor packets from a PCAP file.
Parsing: Parse sensor packets.
Calibration: Apply sensor calibration.
Frame Accumulation: Accumulate sensor points and detect frames.
Note
Currently, the Cepton LiDAR packet formats are under active development, and are not publicly available. The SDK is required for Parsing and Calibration. All other SDK features are optional, and can be done manually by the user.
Getting Started¶
Below is a very simple SDK usage example. For more complete examples, see Samples.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <cepton_sdk_api.hpp>
int main(int argc, char **argv) {
// Initialize SDK with default options
CEPTON_CHECK_ERROR(
cepton_sdk::api::initialize(cepton_sdk::create_options(), "", true));
// Get all sensors
for (int i = 0; i < cepton_sdk::get_n_sensors(); ++i) {
cepton_sdk::SensorInformation sensor_info;
CEPTON_CHECK_ERROR(
cepton_sdk::get_sensor_information_by_index(i, sensor_info));
}
// Listen for points
cepton_sdk::api::SensorImageFrameCallback callback;
CEPTON_CHECK_ERROR(callback.initialize());
CEPTON_CHECK_ERROR(
callback.listen([&](cepton_sdk::SensorHandle handle, std::size_t n_points,
const cepton_sdk::SensorImagePoint *c_image_points) {
// Get sensor info
cepton_sdk::SensorInformation sensor_info;
CEPTON_CHECK_ERROR(
cepton_sdk::get_sensor_information(handle, sensor_info));
// Convert points
std::vector<cepton_sdk::util::SensorPoint> points(n_points);
for (int i = 0; i < n_points; ++i) {
cepton_sdk::util::convert_sensor_image_point_to_point(
c_image_points[i], points[i]);
}
}));
// Sleep or do other work...
// Deinitialize SDK
cepton_sdk::deinitialize().ignore();
}
|
For prototyping, it is recommended to use the high level C++ API. The C++ API also acts as reference code for C API usage. Any C++ functions that directly wrap C functions are not documented; refer to the C function documentation.
The general C SDK workflow is as follows:
Initialize SDK (
cepton_sdk_initialize()
). See Setup.Register point listener callback function (
cepton_sdk_listen_image_frames()
). See Points.Wait for sensor calibration/information packets, then query sensors. See Sensors.
Sleep or run replay. Callbacks will occur asynchronously.
Deinitialize SDK.
Packets¶
The SDK passively listens for sensor UDP packets. There are 2 types of sensor packets:
Calibration/Information: Contains sensor calibration, statistics, and other information. Published at
~1Hz
.Points: Contains
~100
measurements. Published at~1000Hz
.
Errors¶
Many SDK functions return CeptonSensorErrorCode
. If this is not CEPTON_SUCCESS
, then the user must call cepton_sdk_get_error()
, otherwise the SDK will complain that the error was not checked.
All sensor errors will be returned via FpCeptonSensorErrorCallback
, which is registered in cepton_sdk_initialize()
.
Timestamps¶
All int64
timestamps are microseconds since the Unix epoch (UTC). All float
times (measurement period, replay time, frame length, etc.) are time differences measured in seconds. Point timestamps are based on one of the following sources (the first valid source is used):
GPS (NMEA + PPS)
PTP
Host PC
Sensor Fusion¶
See Process Single, Process Multi.
Multiple Returns¶
To enable multiple returns, pass the CEPTON_SDK_CONTROL_ENABLE_MULTIPLE_RETURNS
flag during initialization.
The returns are as follows:
Strongest signal.
Furthest signal, if it is not the strongest. Otherwise, the second strongest signal.