Go to the documentation of this file.
102 default: {
CRL_EXCEPTION(
"Unsupported disparity value %d", disparity);}
112 std::vector<DataSource> sources;
140 for (
const auto &source : sources)
165 default: {
CRL_DEBUG(
"Unsupported source %d",
static_cast<int32_t
>(source));}
184 default: {
return std::vector<DataSource>{source};}
197 case wire::ImuSample::TYPE_ACCEL:
204 case wire::ImuSample::TYPE_GYRO:
211 case wire::ImuSample::TYPE_MAG:
229 return static_cast<uint32_t
>(std::distance(std::begin(rates),
230 std::find_if(std::begin(rates), std::end(rates),
231 [&rate](
const auto &e)
233 return (std::abs(e.sample_rate - rate.
sample_rate) < 1e-6 &&
240 return static_cast<uint32_t
>(std::distance(std::begin(ranges),
241 std::find_if(std::begin(ranges), std::end(ranges),
242 [&range](
const auto &e)
244 return (std::abs(e.range - range.
range) < 1e-6 &&
245 std::abs(e.resolution - range.
resolution) < 1e-6);
251 std::string lower_units = units;
252 std::transform(lower_units.begin(), lower_units.end(), lower_units.begin(),
253 [](
unsigned char c){ return static_cast<char>(std::tolower(c));});
256 if (lower_units ==
"g" || lower_units ==
"gs")
260 else if (lower_units ==
"millig" || lower_units ==
"milli-g")
266 CRL_DEBUG(
"Unknown acceleration units: %s\n", units.c_str());
274 std::string lower_units = units;
275 std::transform(lower_units.begin(), lower_units.end(), lower_units.begin(),
276 [](
unsigned char c){ return static_cast<char>(std::tolower(c));});
278 if (lower_units ==
"dps" || lower_units ==
"degrees-per-second")
282 else if (lower_units ==
"rps" || units ==
"radians-per-second")
288 CRL_DEBUG(
"Unknown gyroscope units: %s\n", units.c_str());
296 std::string lower_units = units;
297 std::transform(lower_units.begin(), lower_units.end(), lower_units.begin(),
298 [](
unsigned char c){ return static_cast<char>(std::tolower(c));});
300 if (lower_units ==
"gauss")
304 else if (lower_units ==
"milligauss" || units ==
"milli-gauss")
310 CRL_DEBUG(
"Unknown magnetometer units: %s\n", units.c_str());
320 for (
const auto &mode : info.
details)
322 if (mode.name ==
"accelerometer")
327 else if (mode.name ==
"gyroscope")
332 else if (mode.name ==
"magnetometer")
A generic measurement for a 3-axis IMU.
@ RIGHT_RECTIFIED_COMPRESSED
static CRL_CONSTEXPR Status Status_Failed
double gyroscope_scale
Scale for the gyroscope_scale to convert wire samples into degrees/sec.
static CRL_CONSTEXPR Status Status_Ok
static CRL_CONSTEXPR Status Status_Error
#define CRL_DEBUG(fmt,...)
MultiSenseConfig::MaxDisparities get_disparities(size_t disparity)
Convert a disparity integer to a fixed disparity setting.
static CRL_CONSTEXPR SourceType SOURCE_CHROMA_AUX
static CRL_CONSTEXPR SourceType SOURCE_LUMA_AUX
std::optional< Measurement > gyroscope
The rotational velocity in degrees-per-second. Depending on the IMU configuration of the sensor,...
float bandwith_cutoff
The bandwith cutoff for a given IMU mode in Hz.
MaxDisparities
Predefined disparity pixel search windows. Larger values allows the camera to see objects closer to t...
float sample_rate
The sample rate for the sensor in Hz.
@ LEFT_DISPARITY_COMPRESSED
ImuSampleScalars get_imu_scalars(const crl::multisense::details::wire::ImuInfo &info)
Get IMU scalars from the cameras's reported IMU info.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_RECTIFIED_AUX
The range for each sensor along with the corresponding sampling resolution.
uint32_t get_rate_index(const std::vector< ImuRate > &rates, const ImuRate &rate)
Get the index of the rate in a vector of rates.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_RIGHT
ImuSample add_wire_sample(ImuSample sample, const crl::multisense::details::wire::ImuSample &wire, const ImuSampleScalars &scalars)
Add a wire sample to a ImuSample.
constexpr crl::multisense::details::wire::SourceType all_sources
All the supported wire source types created for convenience.
std::optional< Measurement > accelerometer
The acceleration in units of Gs. Depending on the IMU configuration of the sensor,...
static CRL_CONSTEXPR Status Status_Unsupported
DataSource
Identifies which camera or data source the image is from.
#define CRL_EXCEPTION(fmt,...)
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RECT_AUX
static CRL_CONSTEXPR Status Status_Unknown
static CRL_CONSTEXPR SourceType SOURCE_DISPARITY
double get_gyroscope_scale(const std::string &units)
Get a scale for the gyroscope value based on a units string.
A single IMU sample from the camera.
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RECT_LEFT
Status get_status(const crl::multisense::details::wire::Ack::AckStatus &status)
std::vector< DataSource > convert_sources(const crl::multisense::details::wire::SourceType &source)
Convert wire sources to a vector of DataSources.
double magnetometer_scale
Scale for the magnetometer to convert wire samples into milligauss.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_LEFT
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RIGHT
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RECT_RIGHT
std::optional< Measurement > magnetometer
The measured magnetic field in milligauss. Depending on the IMU configuration of the sensor,...
A sample rate, and what impact it has on bandwidth.
@ AUX_CHROMA_RECTIFIED_RAW
double accelerometer_scale
Scale for the accelerometer to convert wire samples into G's.
Values to scale IMU samples from the MultiSense camera into standard units LibMultiSense expects.
static CRL_CONSTEXPR Status Status_Exception
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_AUX
static CRL_CONSTEXPR SourceType SOURCE_IMU
MultiSenseInfo::Version get_version(const crl::multisense::details::wire::VersionType &version)
Convert a wire version to a API Version.
bool is_image_source(const DataSource &source)
Determine if a datasource is a image source.
static CRL_CONSTEXPR SourceType SOURCE_LUMA_LEFT
float range
The max value the sensor can return. This value is +/- units for the given source.
double get_acceleration_scale(const std::string &units)
Get a scale for the acceleration value based on a units string.
float resolution
The min resolution the sensor can return. In units per LSB.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_RECTIFIED_LEFT
static CRL_CONSTEXPR Status Status_TimedOut
@ AUX_RECTIFIED_COMPRESSED
uint32_t get_range_index(const std::vector< ImuRange > &ranges, const ImuRange &range)
Get the index of the range in a vector of ranges.
static CRL_CONSTEXPR SourceType SOURCE_DISPARITY_COST
std::vector< DataSource > expand_source(const DataSource &source)
Expand sources since some sources may represent multiple sources on the wire.
std::vector< imu::Details > details
Convenience wrapper for a version number See https://semver.org/.
double get_magnetometer_scale(const std::string &units)
Get a scale for the magnetometer value based on a units string.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_RECTIFIED_RIGHT
@ LEFT_RECTIFIED_COMPRESSED
static CRL_CONSTEXPR SourceType SOURCE_CHROMA_RECT_AUX