Utilities¶
Utility functions and classes for prototyping (cepton_sdk_util.hpp).
Common¶
-
int64_t
cepton_sdk::util
::
get_timestamp_usec
()¶ Returns current unix timestamp [microseconds].
This is the timestamp format used by all sdk functions.
Points¶
-
struct
cepton_sdk::util
::
SensorPoint
¶ 3d point class.
Can’t subclass from SensorImagePoint, needs to be POD.
Public Members
-
int64_t
timestamp
¶ Unix time [microseconds].
-
float
image_x
¶ x image coordinate.
-
float
distance
¶ Distance [meters].
-
float
image_z
¶ z image coordinate.
-
float
intensity
¶ Diffuse reflectance.
-
CeptonSensorReturnType
return_type
¶ Strongest or farthest return.
-
uint8_t
flags
¶ Bit flags.
-
uint8_t
valid
¶ If
false
, then the distance and intensity are invalid.
-
uint8_t
saturated
¶ If
true
, then the intensity is invalid. Also, the distance is valid, but inaccurate.
-
union cepton_sdk::util::SensorPoint::[anonymous] [anonymous]¶
-
float
x
¶ x cartesian coordinate
-
float
y
¶ y cartesian coordinate
-
float
z
¶ z cartesian coordinate
-
int64_t
-
void
cepton_sdk::util
::
convert_sensor_image_point_to_point
(const SensorImagePoint &image_point, SensorPoint &point)¶ Convenience method to convert
cepton_sdk::SensorImagePoint
tocepton_sdk::SensorPoint
.
Callbacks¶
-
template<typename ...
TArgs
>
classcepton_sdk::util
::
Callback
¶ Expands SDK callback functionality.
Allows for multiple callbacks to be registered. Allows for registering lambdas and member functions. See
samples/basic.cpp
.Public Functions
-
void
clear
()¶ Clear all listeners.
-
SensorError
listen
(const std::function<void(TArgs...)> &func, uint64_t *const id = nullptr, )¶ Register std::function.
- Parameters
func
: Callback function.id
: Identifier used forunlisten
.
-
template<typename
TClass
>
SensorErrorlisten
(TClass *const instance, MemberFunction<TClass, TArgs...> func, uint64_t *const id = nullptr)¶ Register instance member function.
- Parameters
instance
: Parent class instance pointer.func
: Callback function pointer.id
: Identifier used forunlisten
.
-
SensorError
unlisten
(uint64_t id)¶ Unregister function.
- Parameters
id
: Identifier returned bylisten
.
-
void
Frames¶
-
template<typename
TData
= bool>
classcepton_sdk::util
::
FrameDetector
: public cepton_sdk::util::internal::FrameDetectorBase<TData>¶ Detects frames in streaming sensor data.
Result::type
Sora: 0=left-right, 1=right-left
HR80: 0=left-right, 1=right-left
Vista: undefined
Public Functions
-
FrameDetector
(const SensorInformation &sensor_info)¶ FrameDetector class constructor passing in SensorInformation.
-
const FrameOptions &
get_options
() const¶ Returns frame options for FrameDetector.
-
SensorError
set_options
(const FrameOptions &options)¶ Set frame options.
-
void
reset
() override¶ Completely resets detector.
Only use if also clearing points accumulator.
-
bool
update
(const SensorImagePoint &point, const TData &data = TData()) override¶ Returns true if frame found.
Automatically resets after frame is found.
-
void
set_frame_mode
(CeptonSDKFrameMode mode)¶
-
class
cepton_sdk::util
::
FrameAccumulator
¶ Accumulates image points, and emits frames to callback.
See
samples/frame.cpp
.Public Functions
-
FrameAccumulator
(const SensorInformation &sensor_info)¶ FrameAccumulator class constructor passing in SensorInformation.
-
FrameOptions
get_options
() const¶ Return frame options for FrameAccumulator.
-
SensorError
set_options
(const FrameOptions &options)¶ Set options for FrameAccumulator.
-
void
clear
()¶
-
void
add_points
(std::size_t n_points, const SensorImagePoint *const image_points)¶
-
Organizer¶
-
struct
cepton_sdk::util
::
OrganizedCloud
¶ The OrganizedCloud struct An organized version of the cepton point cloud.
Public Functions
-
int
getIndex
(int row, int col, int n_return)¶ getIndex Returns the index of the point corresponding to the inputed row, col and return number.
- Return
- Parameters
[in] row
: Row index[in] col
: Col index[in] n_return
: Return index
Public Members
-
int64_t
timestamp_start
¶ timestamp_start The time of the oldest point in the cloud
-
int64_t
timestamp_end
¶ timestamp_end The time of the newest point in the cloud
-
int
height
¶ height Height of the cloud. Represents how many rows there are in the cloud
-
int
width
¶ width Width of the cloud. Represents how many columns there are in the cloud
-
int
n_returns
¶ n_returns Number of return represented by the cloud.
-
std::vector<CellInfo>
info_cells
¶ info_cells Vector of cell info which provide information about the matching points
-
std::vector<CeptonSensorImagePoint>
points
¶ points Vector of organized points. Stored in Return, Row, Col order. So to get a point at row 10, col 15, return 1 would be points[(row * width
col) n_returns + return
-
struct
CellInfo
¶ The CellInfo struct.
Public Members
-
bool
occupied_cell
= false¶ occupied_cell Is the cell at this index occupied with a point. If false can’t assume this represents free space.
-
int
original_index
= -1¶ original_index Index of the point that was used to generate the organized point. Can be used to match back with orginial data if required. Should only be use if occupied_cell is true.
-
bool
-
int
-
class
cepton_sdk::util
::
Organizer
¶ The Organizer class Performs organization on cepton unorganized points. Creates an angular grid, places each point within that grid and outputs a point for each location in the grid in a row/col format. Thread safe. Defaults to a 0.4deg spaced grid.
Public Types
Public Functions
-
Organizer
(cepton_sdk::SensorInformation sensor_info)¶ -
- Parameters
sensor_info
: Sensor info for organizer. Used to set min/max angles
-
void
organize_points
(const int num_points_in, const int n_returns, const CeptonSensorImagePoint *const unorganized_points, cepton_sdk::util::OrganizedCloud &organized_points)¶ organize_points
- Parameters
[in] num_points_in
: Number of unorganized points[in] n_returns
: Number of returns[in] unorganized_points
: Unorganized points to proces[out] organized_points
: Points in organized form
-
void
mode
(OrganizerMode mode)¶ mode
- Parameters
mode
: Change the mode of the organizer. [RECENT] Points are the most recent which fill within the grid. [CENTER] Points outputted are at the center of the grid. More even spacing but less accurate.
-
void
binSize
(float bin_size)¶ binSize Change the bin size of the organizer
- Parameters
bin_size
: The horizontal and vertical bin size to set. In radians
-
void
settings
(OrganizerSettings organizer_settings)¶ settings
- Parameters
organizer_settings
: Change organizer settings
-
OrganizerSettings
settings
()¶ settings
- Return
The settings the organizer is using
-
struct
OrganizerSettings
¶ Public Members
-
float
horizontal_range_radians
= to_radians(70.f)¶
-
float
vertical_range_radians
= to_radians(30.f)¶
-
float
horizontal_bin_size_radians
= to_radians(0.4f)¶
-
float
vertical_bin_size_radians
= to_radians(0.4f)¶
-
OrganizerMode
mode
= OrganizerMode::RECENT¶
-
float
-