|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
4 #ifndef LIBREALSENSE_RS2_DEVICE_HPP
5 #define LIBREALSENSE_RS2_DEVICE_HPP
15 class pipeline_profile;
28 std::shared_ptr<rs2_sensor_list> list(
36 std::vector<sensor> results;
37 for (
auto i = 0; i <
size; i++)
39 std::shared_ptr<rs2_sensor> dev(
45 results.push_back(rs2_dev);
56 if (
auto t = s.as<T>())
return t;
58 throw rs2::error(
"Could not find requested sensor type!");
71 return is_supported > 0;
112 operator bool()
const
114 return _dev !=
nullptr;
116 const std::shared_ptr<rs2_device>&
get()
const
138 explicit operator std::shared_ptr<rs2_device>() {
return _dev; };
139 explicit device(std::shared_ptr<rs2_device> dev) :
_dev(dev) {}
146 std::shared_ptr<rs2_device>
_dev;
193 std::vector<uint8_t> results;
196 std::shared_ptr<const rs2_raw_data_buffer> list(
214 std::vector<uint8_t> results;
217 std::shared_ptr<const rs2_raw_data_buffer> list(
276 void update(
const std::vector<uint8_t>& fw_image)
const
286 void update(
const std::vector<uint8_t>& fw_image, T callback)
const
374 std::vector<uint8_t> results;
426 std::vector<uint8_t> results;
429 std::shared_ptr<const rs2_raw_data_buffer> list(
468 std::vector<uint8_t> results;
471 std::shared_ptr<const rs2_raw_data_buffer> list(
509 std::vector<uint8_t> results;
512 std::shared_ptr<const rs2_raw_data_buffer> list(
533 std::vector<uint8_t> results;
536 std::shared_ptr<const rs2_raw_data_buffer> list(
566 template<
class callback >
604 template<
typename T >
660 std::vector<uint8_t> results;
663 std::shared_ptr<const rs2_raw_data_buffer> list(
683 : _list(
move(list)) {}
688 operator std::vector<device>()
const
690 std::vector<device> res;
691 for (
auto&& dev : *
this) res.push_back(dev);
712 std::shared_ptr<rs2_device> dev(
747 return _list[_index];
751 return other._index != _index || &other._list != &_list;
755 return !(*
this != other);
781 operator std::shared_ptr<rs2_device_list>() {
return _list; };
784 std::shared_ptr<rs2_device_list> _list;
840 return is_enabled != 0;
889 auto from_sensor = get_sensor_profile(from_stream, from_id);
890 auto to_sensor = get_sensor_profile(to_stream, to_id);
891 rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &extrinsics, &e);
910 std::pair<sensor, stream_profile> get_sensor_profile(
rs2_stream stream_type,
int stream_index) {
912 for (
auto p : s.get_stream_profiles()) {
913 if (p.stream_type() == stream_type && p.stream_index() == stream_index)
914 return std::pair<sensor, stream_profile>(s, p);
917 return std::pair<sensor, stream_profile>();
921 #endif // LIBREALSENSE_RS2_DEVICE_HPP
bool operator!=(const device_list_iterator &other) const
void update_unsigned(const std::vector< uint8_t > &image, T callback, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
rs2_device * rs2_create_device(const rs2_device_list *info_list, int index, rs2_error **error)
Creates a device by index.
void rs2_update_firmware_unsigned_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, int update_mode, rs2_error **error)
Update device to the provided firmware by writing raw data directly to the flash, this command can be...
calibration_table run_on_chip_calibration(std::string json_content, float *health, T callback, int timeout_ms=5000) const
This will improve the depth noise.
update_progress_callback(T callback)
bool is_loopback_enabled() const
Checks if the device is in loopback mode or not.
void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics &extrinsics)
Set tm2 camera extrinsics.
void enter_update_state() const
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
void rs2_write_calibration(const rs2_device *device, rs2_error **e)
Write calibration to device's EEPROM.
calibration_change_device()=default
void write_calibration() const
Write calibration that was set by set_calibration_table to device's EEPROM.
device_list(std::shared_ptr< rs2_device_list > list)
void rs2_loopback_enable(const rs2_device *device, const char *from_file, rs2_error **error)
Enter the given device into loopback operation mode that uses the given file as input for raw data.
device_list_iterator & operator++()
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
Check if a camera supports a specific camera info type.
bool contains(const device &dev) const
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
Test if the given device can be extended to the requested extension.
void rs2_register_calibration_change_callback_cpp(rs2_device *dev, rs2_calibration_change_callback *callback, rs2_error **error)
Adds a callback for a sensor that gets called when calibration (intrinsics) changes,...
rs2_calibration_status
Used in device_calibration with rs2_calibration_change_callback.
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms=5000) const
This will adjust camera absolute distance to flat target.
void update(const std::vector< uint8_t > &fw_image) const
device_list & operator=(std::shared_ptr< rs2_device_list > list)
calibration_table get_calibration_table()
Read current calibration table from flash.
rs2_camera_info
Read-only strings that can be queried from the device.
device operator[](uint32_t index) const
void rs2_set_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_intrinsics *intrinsics, rs2_error **error)
Set intrinsics of a given sensor.
device_calibration(device d)
bool check_firmware_compatibility(const std::vector< uint8_t > &image) const
void rs2_set_calibration_table(const rs2_device *device, const void *calibration, int calibration_size, rs2_error **error)
Set current table to dynamic area.
bool supports(rs2_camera_info info) const
check if specific camera info is supported
void disable_loopback()
Restores the given device into normal operation mode.
@ RS2_EXTENSION_AUTO_CALIBRATED_DEVICE
bool operator==(const device_list_iterator &other) const
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
Checks if a specific device is contained inside a device list.
device_hub class - encapsulate the handling of connect and disconnect events
void rs2_update_firmware_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, rs2_error **error)
Update device to the provided firmware, the device must be extendable to RS2_EXTENSION_UPDATABLE.
int rs2_check_firmware_compatibility(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_error **error)
Checks if the device and the provided firmware image are compatible.
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
Create a static snapshot of all connected sensors within a specific device.
void rs2_loopback_disable(const rs2_device *device, rs2_error **error)
Restores the given device into normal operation mode.
The tm2 class is an interface for T2XX devices, such as T265.
Motion device intrinsics: scale, bias, and variances.
const rs2_raw_data_buffer * rs2_send_and_receive_raw_data(rs2_device *device, void *raw_data_to_send, unsigned size_of_raw_data_to_send, rs2_error **error)
Send raw data to device.
const rs2_device_list * get_list() const
int rs2_loopback_is_enabled(const rs2_device *device, rs2_error **error)
Checks if the device is in loopback mode or not.
device_list_iterator begin() const
constexpr const char * start
device & operator=(const device &dev)
device & operator=(const std::shared_ptr< rs2_device > dev)
const std::shared_ptr< rs2_device > & get() const
const rs2_raw_data_buffer * rs2_run_tare_calibration_cpp(rs2_device *dev, float ground_truth_mm, const void *json_content, int content_size, rs2_update_progress_callback *progress_callback, int timeout_ms, rs2_error **error)
This will adjust camera absolute distance to flat target.
void update_unsigned(const std::vector< uint8_t > &image, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
void set_calibration_table(const calibration_table &calibration)
Set current table to dynamic area.
rs2_calibration_type
Used in device_calibration; enumerates the different calibration types available for that extension.
void enable_loopback(const std::string &from_file)
Enter the given device into loopback operation mode that uses the given file as input for raw data.
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
Deletes sensors list, any sensors created from this list will remain unaffected.
void rs2_set_extrinsics(const rs2_sensor *from_sensor, const rs2_stream_profile *from_profile, rs2_sensor *to_sensor, const rs2_stream_profile *to_profile, const rs2_extrinsics *extrinsics, rs2_error **error)
Set extrinsics between two sensors.
struct rs2_device_list rs2_device_list
void hardware_reset()
send hardware reset request to the device
void rs2_delete_sensor(rs2_sensor *sensor)
delete relasense sensor
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
Delete rs2_raw_data_buffer.
void rs2_trigger_device_calibration(rs2_device *dev, rs2_calibration_type type, rs2_error **error)
Triggers calibration of the given type.
int rs2_get_device_count(const rs2_device_list *info_list, rs2_error **error)
Determines number of devices in a list.
constexpr absl::OTABSL_OPTION_NAMESPACE_NAME::remove_reference_t< T > && move(T &&t) noexcept
device(std::shared_ptr< rs2_device > dev)
std::vector< uint8_t > send_and_receive_raw_data(const std::vector< uint8_t > &input) const
@ RS2_STREAM_FISHEYE
Native stream of fish-eye (wide) data captured from the dedicate motion camera.
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
Retrieve camera specific information, like versions of various internal components.
void connect_controller(const std::array< uint8_t, 6 > &mac_addr)
Connects to a given tm2 controller.
std::vector< uint8_t > create_flash_backup() const
constexpr const char * size
const rs2_raw_data_buffer * rs2_run_on_chip_calibration_cpp(rs2_device *device, const void *json_content, int content_size, float *health, rs2_update_progress_callback *progress_callback, int timeout_ms, rs2_error **error)
This will improve the depth noise.
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms=5000) const
This will adjust camera absolute distance to flat target.
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
Create backup of camera flash memory.
const std::shared_ptr< rs2_sensor > & get() const
@ RS2_EXTENSION_UPDATE_DEVICE
void register_calibration_change_callback(T callback)
void rs2_delete_device(rs2_device *device)
Delete RealSense device.
int rs2_get_sensors_count(const rs2_sensor_list *info_list, rs2_error **error)
Determines number of sensors in a list.
calibration_change_device(device d)
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
Send hardware reset request to the device.
void trigger_device_calibration(rs2_calibration_type type)
This will trigger the given calibration, if available.
void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics &intrinsics)
Set tm2 camera intrinsics.
void on_calibration_change(rs2_calibration_status status) noexcept override
calibration_table run_on_chip_calibration(std::string json_content, float *health, int timeout_ms=5000) const
This will improve the depth noise.
calibration_change_callback(callback cb)
void on_update_progress(const float progress) override
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
create sensor by index
default librealsense context class includes realsense API version as provided by RS2_API_VERSION macr...
@ RS2_EXTENSION_UPDATABLE
void disconnect_controller(int id)
Disconnects a given tm2 controller.
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
get the size of rs2_raw_data_buffer
void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic &motion_intriniscs)
Set tm2 motion device intrinsics.
@ RS2_EXTENSION_CALIBRATION_CHANGE_DEVICE
auto_calibrated_device(device d)
@ RS2_EXTENSION_DEVICE_CALIBRATION
void rs2_set_motion_device_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
Set motion device intrinsics.
std::vector< uint8_t > calibration_table
static void handle(rs2_error *e)
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
Enter the device to update state, this will cause the updatable device to disconnect and reconnect as...
void reset_to_factory_calibration()
Reset device to factory calibration.
void update(const std::vector< uint8_t > &fw_image, T callback) const
calibrated_device(device d)
void rs2_reset_to_factory_calibration(const rs2_device *device, rs2_error **e)
Reset device to factory calibration.
#define RS2_UNSIGNED_UPDATE_MODE_UPDATE
const char * get_info(rs2_camera_info info) const
retrieve camera specific information, like versions of various internal components
The pipeline profile includes a device and a selection of active streams, with specific profiles.
device_calibration()=default
std::shared_ptr< rs2_device > _dev
std::vector< uint8_t > create_flash_backup(T callback) const
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
Retrieve char array from rs2_raw_data_buffer.
void rs2_disconnect_tm2_controller(const rs2_device *device, int id, rs2_error **error)
Disconnects a given tm2 controller.
std::vector< sensor > query_sensors() const
returns the list of adjacent devices, sharing the same physical parent composite device
void rs2_connect_tm2_controller(const rs2_device *device, const unsigned char *mac_addr, rs2_error **error)
Connects to a given tm2 controller.
device_list_iterator end() const
rs2_stream
Streams are different types of data provided by RealSense devices.
const rs2_raw_data_buffer * rs2_get_calibration_table(const rs2_device *dev, rs2_error **error)
Read current calibration table from flash.
struct rs2_error rs2_error