Go to the documentation of this file.
49 #include "MultiSense/MultiSenseTypes.hh"
175 template <
typename QueryMessage,
class Rep,
class Period>
178 const QueryMessage &query,
179 uint16_t sequence_id,
181 const std::optional<std::chrono::duration<Rep, Period>>& wait_time,
186 std::optional<wire::Ack> output = std::nullopt;
190 for (
size_t i = 0 ; i < attempts ; ++i)
197 if (
auto ack = ack_waiter->wait<
wire::Ack>(wait_time); ack)
199 output = std::move(ack);
214 template <
typename OutputMessage,
typename QueryMessage,
class Rep,
class Period>
217 const QueryMessage &query,
218 uint16_t sequence_id,
220 const std::optional<std::chrono::duration<Rep, Period>>& wait_time,
225 std::optional<OutputMessage> output = std::nullopt;
230 for (
size_t i = 0 ; i < attempts ; ++i)
237 if (
auto ack = ack_waiter->wait<
wire::Ack>(wait_time); ack)
244 if (
auto response = response_waiter->wait<OutputMessage>(wait_time); response)
246 output = std::move(response);
258 template <
typename T>
281 template <
typename OutputMessage,
typename QueryMessage,
class Rep,
class Period>
284 const QueryMessage &query,
285 uint16_t sequence_id,
287 const std::optional<std::chrono::duration<Rep, Period>>& wait_time,
292 std::optional<TimedResponse<OutputMessage>> output = std::nullopt;
297 for (
size_t i = 0 ; i < attempts ; ++i)
299 const auto serialized_data =
serialize(query, sequence_id, mtu);
301 const auto send = std::chrono::system_clock::now().time_since_epoch();
302 const auto start = std::chrono::high_resolution_clock::now();
309 if (
auto ack = ack_waiter->wait<
wire::Ack>(wait_time); ack)
311 const auto end = std::chrono::high_resolution_clock::now();
318 if (
auto response = response_waiter->wait<OutputMessage>(wait_time); response)
double gyroscope_scale
Scale for the gyroscope_scale to convert wire samples into degrees/sec.
static CRL_CONSTEXPR Status Status_Ok
std::optional< OutputMessage > wait_for_data(MessageAssembler &assembler, const NetworkSocket &socket, const QueryMessage &query, uint16_t sequence_id, uint16_t mtu, const std::optional< std::chrono::duration< Rep, Period >> &wait_time, size_t attempts=1)
Helper to wait for data from the camera from a given query command. Once a query command is sent to t...
std::chrono::nanoseconds host_transmit_receive_roundtrip
The time between when the status request was sent and when the camera ack'd the response.
Process incoming network data, and try the data into valid MultiSense Wire messages.
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
T message
The response message.
MaxDisparities
Predefined disparity pixel search windows. Larger values allows the camera to see objects closer to t...
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.
DataSource
Identifies which camera or data source the image is from.
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RECT_AUX
static CRL_CONSTEXPR SourceType SOURCE_DISPARITY
std::vector< uint8_t > serialize(const T &message, uint16_t sequence_id, size_t mtu)
Serialize a MultiSense Wire message for transmission. This adds the wire header to the message for tr...
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.
int64_t publish_data(const NetworkSocket &socket, const std::vector< uint8_t > &data)
Convenience function used to user specified data out on the host's UDP socket.
static CRL_CONSTEXPR SourceType SOURCE_LUMA_RECT_LEFT
Status get_status(const crl::multisense::details::wire::Ack::AckStatus &status)
Convenience network socket object which contains the data corresponding to our connection.
std::shared_ptr< MessageCondition > register_message(const crl::multisense::details::wire::IdType &message_id)
Register to be notified when a message of a given id arrives. Note this registration will only receiv...
void remove_registration(const crl::multisense::details::wire::IdType &message_id)
Remove a registration for a specific message type.
std::vector< DataSource > convert_sources(const crl::multisense::details::wire::SourceType &source)
Convert wire sources to a vector of DataSources.
std::optional< crl::multisense::details::wire::Ack > wait_for_ack(MessageAssembler &assembler, const NetworkSocket &socket, const QueryMessage &query, uint16_t sequence_id, uint16_t mtu, const std::optional< std::chrono::duration< Rep, Period >> &wait_time, size_t attempts=1)
Helper to wait for ack from the camera from a given query command. Once a query command is sent to th...
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
A sample rate, and what impact it has on bandwidth.
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 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
double get_acceleration_scale(const std::string &units)
Get a scale for the acceleration value based on a units string.
static CRL_CONSTEXPR SourceType SOURCE_COMPRESSED_RECTIFIED_LEFT
std::chrono::nanoseconds host_start_transmit_time
The host system time the request which triggered the response message was sent.
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.
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
std::optional< TimedResponse< OutputMessage > > wait_for_data_timed(MessageAssembler &assembler, const NetworkSocket &socket, const QueryMessage &query, uint16_t sequence_id, uint16_t mtu, const std::optional< std::chrono::duration< Rep, Period >> &wait_time, size_t attempts=1)
Helper to wait for data from the camera from a given query command. Once a query command is sent to t...
static CRL_CONSTEXPR SourceType SOURCE_CHROMA_RECT_AUX