Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
rs_device.hpp
Go to the documentation of this file.
1// License: Apache 2.0. See LICENSE file in root directory.
2// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3
4#ifndef LIBREALSENSE_RS2_DEVICE_HPP
5#define LIBREALSENSE_RS2_DEVICE_HPP
6
7#include "rs_types.hpp"
8#include "rs_sensor.hpp"
9#include <array>
10
11namespace rs2
12{
13 class context;
14 class device_list;
15 class pipeline_profile;
16 class device_hub;
17
18 class device
19 {
20 public:
25 std::vector<sensor> query_sensors() const
26 {
27 rs2_error* e = nullptr;
28 std::shared_ptr<rs2_sensor_list> list(
29 rs2_query_sensors(_dev.get(), &e),
32
33 auto size = rs2_get_sensors_count(list.get(), &e);
35
36 std::vector<sensor> results;
37 for (auto i = 0; i < size; i++)
38 {
39 std::shared_ptr<rs2_sensor> dev(
40 rs2_create_sensor(list.get(), i, &e),
43
44 sensor rs2_dev(dev);
45 results.push_back(rs2_dev);
46 }
47
48 return results;
49 }
50
51 template<class T>
52 T first() const
53 {
54 for (auto&& s : query_sensors())
55 {
56 if (auto t = s.as<T>()) return t;
57 }
58 throw rs2::error("Could not find requested sensor type!");
59 }
60
66 bool supports(rs2_camera_info info) const
67 {
68 rs2_error* e = nullptr;
69 auto is_supported = rs2_supports_device_info(_dev.get(), info, &e);
71 return is_supported > 0;
72 }
73
79 const char* get_info(rs2_camera_info info) const
80 {
81 rs2_error* e = nullptr;
82 auto result = rs2_get_device_info(_dev.get(), info, &e);
84 return result;
85 }
86
91 {
92 rs2_error* e = nullptr;
93
94 rs2_hardware_reset(_dev.get(), &e);
96 }
97
98 device& operator=(const std::shared_ptr<rs2_device> dev)
99 {
100 _dev.reset();
101 _dev = dev;
102 return *this;
103 }
105 {
106 *this = nullptr;
107 _dev = dev._dev;
108 return *this;
109 }
110 device() : _dev(nullptr) {}
111
112 operator bool() const
113 {
114 return _dev != nullptr;
115 }
116 const std::shared_ptr<rs2_device>& get() const
117 {
118 return _dev;
119 }
120
121 template<class T>
122 bool is() const
123 {
124 T extension(*this);
125 return extension;
126 }
127
128 template<class T>
129 T as() const
130 {
131 T extension(*this);
132 return extension;
133 }
134 virtual ~device()
135 {
136 }
137
138 explicit operator std::shared_ptr<rs2_device>() { return _dev; };
139 explicit device(std::shared_ptr<rs2_device> dev) : _dev(dev) {}
140 protected:
141 friend class rs2::context;
142 friend class rs2::device_list;
144 friend class rs2::device_hub;
145
146 std::shared_ptr<rs2_device> _dev;
147
148 };
149
150 template<class T>
152 {
153 T _callback;
154
155 public:
156 explicit update_progress_callback(T callback) : _callback(callback) {}
157
158 void on_update_progress(const float progress) override
159 {
160 _callback(progress);
161 }
162
163 void release() override { delete this; }
164 };
165
166 class updatable : public device
167 {
168 public:
171 : device(d.get())
172 {
173 rs2_error* e = nullptr;
175 {
176 _dev.reset();
177 }
178 error::handle(e);
179 }
180
181 // Move the device to update state, this will cause the updatable device to disconnect and reconnect as an update device.
183 {
184 rs2_error* e = nullptr;
185 rs2_enter_update_state(_dev.get(), &e);
186 error::handle(e);
187 }
188
189 // Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
190 // loaded back to the device, but it does contain all calibration and device information."
191 std::vector<uint8_t> create_flash_backup() const
192 {
193 std::vector<uint8_t> results;
194
195 rs2_error* e = nullptr;
196 std::shared_ptr<const rs2_raw_data_buffer> list(
197 rs2_create_flash_backup_cpp(_dev.get(), nullptr, &e),
199 error::handle(e);
200
201 auto size = rs2_get_raw_data_size(list.get(), &e);
202 error::handle(e);
203
204 auto start = rs2_get_raw_data(list.get(), &e);
205
206 results.insert(results.begin(), start, start + size);
207
208 return results;
209 }
210
211 template<class T>
212 std::vector<uint8_t> create_flash_backup(T callback) const
213 {
214 std::vector<uint8_t> results;
215
216 rs2_error* e = nullptr;
217 std::shared_ptr<const rs2_raw_data_buffer> list(
218 rs2_create_flash_backup_cpp(_dev.get(), new update_progress_callback<T>(std::move(callback)), &e),
220 error::handle(e);
221
222 auto size = rs2_get_raw_data_size(list.get(), &e);
223 error::handle(e);
224
225 auto start = rs2_get_raw_data(list.get(), &e);
226
227 results.insert(results.begin(), start, start + size);
228
229 return results;
230 }
231
232 // check firmware compatibility with SKU
233 bool check_firmware_compatibility(const std::vector<uint8_t>& image) const
234 {
235 rs2_error* e = nullptr;
236 auto res = !!rs2_check_firmware_compatibility(_dev.get(), image.data(), (int)image.size(), &e);
237 error::handle(e);
238 return res;
239 }
240
241 // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread.
242 void update_unsigned(const std::vector<uint8_t>& image, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
243 {
244 rs2_error* e = nullptr;
245 rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), (int)image.size(), nullptr, update_mode, &e);
246 error::handle(e);
247 }
248
249 // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread and it supports progress notifications via the callback.
250 template<class T>
251 void update_unsigned(const std::vector<uint8_t>& image, T callback, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
252 {
253 rs2_error* e = nullptr;
254 rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), int(image.size()), new update_progress_callback<T>(std::move(callback)), update_mode, &e);
255 error::handle(e);
256 }
257 };
258
259 class update_device : public device
260 {
261 public:
264 : device(d.get())
265 {
266 rs2_error* e = nullptr;
268 {
269 _dev.reset();
270 }
271 error::handle(e);
272 }
273
274 // Update an updatable device to the provided firmware.
275 // This call is executed on the caller's thread.
276 void update(const std::vector<uint8_t>& fw_image) const
277 {
278 rs2_error* e = nullptr;
279 rs2_update_firmware_cpp(_dev.get(), fw_image.data(), (int)fw_image.size(), NULL, &e);
280 error::handle(e);
281 }
282
283 // Update an updatable device to the provided firmware.
284 // This call is executed on the caller's thread and it supports progress notifications via the callback.
285 template<class T>
286 void update(const std::vector<uint8_t>& fw_image, T callback) const
287 {
288 rs2_error* e = nullptr;
289 rs2_update_firmware_cpp(_dev.get(), fw_image.data(), int(fw_image.size()), new update_progress_callback<T>(std::move(callback)), &e);
290 error::handle(e);
291 }
292 };
293
294 typedef std::vector<uint8_t> calibration_table;
295
297 {
298 public:
300 : device(d.get())
301 {}
302
306 void write_calibration() const
307 {
308 rs2_error* e = nullptr;
309 rs2_write_calibration(_dev.get(), &e);
310 error::handle(e);
311 }
312
317 {
318 rs2_error* e = nullptr;
320 error::handle(e);
321 }
322 };
323
325 {
326 public:
329 {
330 rs2_error* e = nullptr;
332 {
333 _dev.reset();
334 }
335 error::handle(e);
336 }
337
371 template<class T>
372 calibration_table run_on_chip_calibration(std::string json_content, float* health, T callback, int timeout_ms = 5000) const
373 {
374 std::vector<uint8_t> results;
375
376 rs2_error* e = nullptr;
377 auto buf = rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), int(json_content.size()), health, new update_progress_callback<T>(std::move(callback)), timeout_ms, &e);
378 error::handle(e);
379
380 std::shared_ptr<const rs2_raw_data_buffer> list(buf, rs2_delete_raw_data);
381
382 auto size = rs2_get_raw_data_size(list.get(), &e);
383 error::handle(e);
384
385 auto start = rs2_get_raw_data(list.get(), &e);
386
387 results.insert(results.begin(), start, start + size);
388
389 return results;
390 }
391
424 calibration_table run_on_chip_calibration(std::string json_content, float* health, int timeout_ms = 5000) const
425 {
426 std::vector<uint8_t> results;
427
428 rs2_error* e = nullptr;
429 std::shared_ptr<const rs2_raw_data_buffer> list(
430 rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), static_cast< int >( json_content.size() ), health, nullptr, timeout_ms, &e),
432 error::handle(e);
433 auto size = rs2_get_raw_data_size(list.get(), &e);
434 error::handle(e);
435
436 auto start = rs2_get_raw_data(list.get(), &e);
437
438 results.insert(results.begin(), start, start + size);
439
440 return results;
441 }
442
466 template<class T>
467 calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms = 5000) const
468 {
469 std::vector<uint8_t> results;
470
471 rs2_error* e = nullptr;
472 std::shared_ptr<const rs2_raw_data_buffer> list(
473 rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), int(json_content.size()), new update_progress_callback<T>(std::move(callback)), timeout_ms, &e),
475 error::handle(e);
476
477 auto size = rs2_get_raw_data_size(list.get(), &e);
478 error::handle(e);
479
480 auto start = rs2_get_raw_data(list.get(), &e);
481
482 results.insert(results.begin(), start, start + size);
483
484 return results;
485 }
486
509 calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms = 5000) const
510 {
511 std::vector<uint8_t> results;
512
513 rs2_error* e = nullptr;
514 std::shared_ptr<const rs2_raw_data_buffer> list(
515 rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), static_cast< int >( json_content.size() ), nullptr, timeout_ms, &e),
517 error::handle(e);
518
519 auto size = rs2_get_raw_data_size(list.get(), &e);
520 error::handle(e);
521
522 auto start = rs2_get_raw_data(list.get(), &e);
523
524 results.insert(results.begin(), start, start + size);
525
526 return results;
527 }
528
534 {
535 std::vector<uint8_t> results;
536
537 rs2_error* e = nullptr;
538 std::shared_ptr<const rs2_raw_data_buffer> list(
541 error::handle(e);
542
543 auto size = rs2_get_raw_data_size(list.get(), &e);
544 error::handle(e);
545
546 auto start = rs2_get_raw_data(list.get(), &e);
547
548 results.insert(results.begin(), start, start + size);
549
550 return results;
551 }
552
558 {
559 rs2_error* e = nullptr;
560 rs2_set_calibration_table(_dev.get(), calibration.data(), static_cast< int >( calibration.size() ), &e);
561 error::handle(e);
562 }
563
575 std::vector<uint8_t> run_focal_length_calibration(rs2::frame_queue left, rs2::frame_queue right, float target_w, float target_h, int adjust_both_sides,
576 float* ratio, float* angle) const
577 {
578 std::vector<uint8_t> results;
579
580 rs2_error* e = nullptr;
581 std::shared_ptr<const rs2_raw_data_buffer> list(
582 rs2_run_focal_length_calibration_cpp(_dev.get(), left.get().get(), right.get().get(), target_w, target_h, adjust_both_sides, ratio, angle, nullptr, &e),
584 error::handle(e);
585
586 auto size = rs2_get_raw_data_size(list.get(), &e);
587 error::handle(e);
588
589 auto start = rs2_get_raw_data(list.get(), &e);
590
591 results.insert(results.begin(), start, start + size);
592
593 return results;
594 }
595
607 template<class T>
608 std::vector<uint8_t> run_focal_length_calibration(rs2::frame_queue left, rs2::frame_queue right, float target_w, float target_h, int adjust_both_sides,
609 float* ratio, float* angle, T callback) const
610 {
611 std::vector<uint8_t> results;
612
613 rs2_error* e = nullptr;
614 std::shared_ptr<const rs2_raw_data_buffer> list(
615 rs2_run_focal_length_calibration_cpp(_dev.get(), left.get().get(), right.get().get(), target_w, target_h, adjust_both_sides, ratio, angle,
616 new update_progress_callback<T>(std::move(callback)), &e),
618 error::handle(e);
619
620 auto size = rs2_get_raw_data_size(list.get(), &e);
621 error::handle(e);
622
623 auto start = rs2_get_raw_data(list.get(), &e);
624
625 results.insert(results.begin(), start, start + size);
626
627 return results;
628 }
629
641 std::vector<uint8_t> run_uv_map_calibration(rs2::frame_queue left, rs2::frame_queue color, rs2::frame_queue depth, int py_px_only,
642 float* health, int health_size) const
643 {
644 std::vector<uint8_t> results;
645
646 rs2_error* e = nullptr;
647 std::shared_ptr<const rs2_raw_data_buffer> list(
648 rs2_run_uv_map_calibration_cpp(_dev.get(), left.get().get(), color.get().get(), depth.get().get(), py_px_only, health, health_size, nullptr, &e),
650 error::handle(e);
651
652 auto size = rs2_get_raw_data_size(list.get(), &e);
653 error::handle(e);
654
655 auto start = rs2_get_raw_data(list.get(), &e);
656
657 results.insert(results.begin(), start, start + size);
658
659 return results;
660 }
661
674 template<class T>
675 std::vector<uint8_t> run_uv_map_calibration(rs2::frame_queue left, rs2::frame_queue color, rs2::frame_queue depth, int py_px_only,
676 float* health, int health_size, T callback) const
677 {
678 std::vector<uint8_t> results;
679
680 rs2_error* e = nullptr;
681 std::shared_ptr<const rs2_raw_data_buffer> list(
682 rs2_run_uv_map_calibration_cpp(_dev.get(), left.get().get(), color.get().get(), depth.get().get(), py_px_only, health, health_size,
683 new update_progress_callback<T>(std::move(callback)), &e),
685 error::handle(e);
686
687 auto size = rs2_get_raw_data_size(list.get(), &e);
688 error::handle(e);
689
690 auto start = rs2_get_raw_data(list.get(), &e);
691
692 results.insert(results.begin(), start, start + size);
693
694 return results;
695 }
696
706 float target_width, float target_height) const
707 {
708 rs2_error* e = nullptr;
709 float result = rs2_calculate_target_z_cpp(_dev.get(), queue1.get().get(), queue2.get().get(), queue3.get().get(),
710 target_width, target_height, nullptr, &e);
711 error::handle(e);
712
713 return result;
714 }
715
725 template<class T>
727 float target_width, float target_height, T callback) const
728 {
729 rs2_error* e = nullptr;
730 float result = rs2_calculate_target_z_cpp(_dev.get(), queue1.get().get(), queue2.get().get(), queue3.get().get(),
731 target_width, target_height, new update_progress_callback<T>(std::move(callback)), &e);
732 error::handle(e);
733
734 return result;
735 }
736 };
737
738 /*
739 Wrapper around any callback function that is given to calibration_change_callback.
740 */
741 template< class callback >
743 {
744 //using callback = std::function< void( rs2_calibration_status ) >;
745 callback _callback;
746 public:
747 calibration_change_callback( callback cb ) : _callback( cb ) {}
748
749 void on_calibration_change( rs2_calibration_status status ) noexcept override
750 {
751 _callback( status );
752 }
753 void release() override { delete this; }
754 };
755
757 {
758 public:
761 : device(d.get())
762 {
763 rs2_error* e = nullptr;
765 {
766 _dev.reset();
767 }
768 error::handle(e);
769 }
770
771 /*
772 Your callback should look like this, for example:
773 sensor.register_calibration_change_callback(
774 []( rs2_calibration_status ) noexcept
775 {
776 ...
777 })
778 */
779 template< typename T >
781 {
782 // We wrap the callback with an interface and pass it to librealsense, who will
783 // now manage its lifetime. Rather than deleting it, though, it will call its
784 // release() function, where (back in our context) it can be safely deleted:
785 rs2_error* e = nullptr;
787 _dev.get(),
788 new calibration_change_callback< T >(std::move(callback)),
789 &e);
790 error::handle(e);
791 }
792 };
793
795 {
796 public:
799 {
800 rs2_error* e = nullptr;
802 {
803 _dev = d.get();
804 }
805 error::handle( e );
806 }
807
812 {
813 rs2_error* e = nullptr;
814 rs2_trigger_device_calibration( _dev.get(), type, &e );
815 error::handle( e );
816 }
817 };
818
819 class debug_protocol : public device
820 {
821 public:
823 : device(d.get())
824 {
825 rs2_error* e = nullptr;
826 if(rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_DEBUG, &e) == 0 && !e)
827 {
828 _dev.reset();
829 }
830 error::handle(e);
831 }
832
833 std::vector<uint8_t> send_and_receive_raw_data(const std::vector<uint8_t>& input) const
834 {
835 std::vector<uint8_t> results;
836
837 rs2_error* e = nullptr;
838 std::shared_ptr<const rs2_raw_data_buffer> list(
839 rs2_send_and_receive_raw_data(_dev.get(), (void*)input.data(), (uint32_t)input.size(), &e),
841 error::handle(e);
842
843 auto size = rs2_get_raw_data_size(list.get(), &e);
844 error::handle(e);
845
846 auto start = rs2_get_raw_data(list.get(), &e);
847
848 results.insert(results.begin(), start, start + size);
849
850 return results;
851 }
852 };
853
855 {
856 public:
857 explicit device_list(std::shared_ptr<rs2_device_list> list)
858 : _list(move(list)) {}
859
861 : _list(nullptr) {}
862
863 operator std::vector<device>() const
864 {
865 std::vector<device> res;
866 for (auto&& dev : *this) res.push_back(dev);
867 return res;
868 }
869
870 bool contains(const device& dev) const
871 {
872 rs2_error* e = nullptr;
873 auto res = !!(rs2_device_list_contains(_list.get(), dev.get().get(), &e));
874 error::handle(e);
875 return res;
876 }
877
878 device_list& operator=(std::shared_ptr<rs2_device_list> list)
879 {
880 _list = move(list);
881 return *this;
882 }
883
884 device operator[](uint32_t index) const
885 {
886 rs2_error* e = nullptr;
887 std::shared_ptr<rs2_device> dev(
888 rs2_create_device(_list.get(), index, &e),
890 error::handle(e);
891
892 return device(dev);
893 }
894
895 uint32_t size() const
896 {
897 rs2_error* e = nullptr;
898 auto size = rs2_get_device_count(_list.get(), &e);
899 error::handle(e);
900 return size;
901 }
902
903 device front() const { return std::move((*this)[0]); }
904 device back() const
905 {
906 return std::move((*this)[size() - 1]);
907 }
908
910 {
913 uint32_t uint32_t)
914 : _list(device_list),
915 _index(uint32_t)
916 {
917 }
918
919 public:
921 {
922 return _list[_index];
923 }
924 bool operator!=(const device_list_iterator& other) const
925 {
926 return other._index != _index || &other._list != &_list;
927 }
928 bool operator==(const device_list_iterator& other) const
929 {
930 return !(*this != other);
931 }
933 {
934 _index++;
935 return *this;
936 }
937 private:
938 friend device_list;
939 const device_list& _list;
940 uint32_t _index;
941 };
942
944 {
945 return device_list_iterator(*this, 0);
946 }
948 {
949 return device_list_iterator(*this, size());
950 }
952 {
953 return _list.get();
954 }
955
956 operator std::shared_ptr<rs2_device_list>() { return _list; };
957
958 private:
959 std::shared_ptr<rs2_device_list> _list;
960 };
961
971 class tm2 : public calibrated_device // TODO: add to wrappers [Python done]
972 {
973 public:
976 {
977 rs2_error* e = nullptr;
978 if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_TM2, &e) == 0 && !e)
979 {
980 _dev.reset();
981 }
982 error::handle(e);
983 }
984
989 void enable_loopback(const std::string& from_file)
990 {
991 rs2_error* e = nullptr;
992 rs2_loopback_enable(_dev.get(), from_file.c_str(), &e);
993 error::handle(e);
994 }
995
1000 {
1001 rs2_error* e = nullptr;
1002 rs2_loopback_disable(_dev.get(), &e);
1003 error::handle(e);
1004 }
1005
1011 {
1012 rs2_error* e = nullptr;
1013 int is_enabled = rs2_loopback_is_enabled(_dev.get(), &e);
1014 error::handle(e);
1015 return is_enabled != 0;
1016 }
1017
1022 void connect_controller(const std::array<uint8_t, 6>& mac_addr)
1023 {
1024 rs2_error* e = nullptr;
1025 rs2_connect_tm2_controller(_dev.get(), mac_addr.data(), &e);
1026 error::handle(e);
1027 }
1028
1034 {
1035 rs2_error* e = nullptr;
1036 rs2_disconnect_tm2_controller(_dev.get(), id, &e);
1037 error::handle(e);
1038 }
1039
1045 void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics& intrinsics)
1046 {
1047 rs2_error* e = nullptr;
1048 auto fisheye_sensor = get_sensor_profile(RS2_STREAM_FISHEYE, fisheye_sensor_id);
1049 rs2_set_intrinsics(fisheye_sensor.first.get().get(), fisheye_sensor.second.get(), &intrinsics, &e);
1050 error::handle(e);
1051 }
1052
1061 void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics& extrinsics)
1062 {
1063 rs2_error* e = nullptr;
1064 auto from_sensor = get_sensor_profile(from_stream, from_id);
1065 auto to_sensor = get_sensor_profile(to_stream, to_id);
1066 rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &extrinsics, &e);
1067 error::handle(e);
1068 }
1069
1075 void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic& motion_intriniscs)
1076 {
1077 rs2_error* e = nullptr;
1078 auto motion_sensor = get_sensor_profile(stream_type, 0);
1079 rs2_set_motion_device_intrinsics(motion_sensor.first.get().get(), motion_sensor.second.get(), &motion_intriniscs, &e);
1080 error::handle(e);
1081 }
1082
1083 private:
1084
1085 std::pair<sensor, stream_profile> get_sensor_profile(rs2_stream stream_type, int stream_index) {
1086 for (auto s : query_sensors()) {
1087 for (auto p : s.get_stream_profiles()) {
1088 if (p.stream_type() == stream_type && p.stream_index() == stream_index)
1089 return std::pair<sensor, stream_profile>(s, p);
1090 }
1091 }
1092 return std::pair<sensor, stream_profile>();
1093 }
1094 };
1095}
1096#endif // LIBREALSENSE_RS2_DEVICE_HPP
Definition: rs_device.hpp:325
auto_calibrated_device(device d)
Definition: rs_device.hpp:327
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms=5000) const
Definition: rs_device.hpp:467
float calculate_target_z(rs2::frame_queue queue1, rs2::frame_queue queue2, rs2::frame_queue queue3, float target_width, float target_height) const
Definition: rs_device.hpp:705
std::vector< uint8_t > run_focal_length_calibration(rs2::frame_queue left, rs2::frame_queue right, float target_w, float target_h, int adjust_both_sides, float *ratio, float *angle) const
Definition: rs_device.hpp:575
calibration_table get_calibration_table()
Definition: rs_device.hpp:533
std::vector< uint8_t > run_focal_length_calibration(rs2::frame_queue left, rs2::frame_queue right, float target_w, float target_h, int adjust_both_sides, float *ratio, float *angle, T callback) const
Definition: rs_device.hpp:608
std::vector< uint8_t > run_uv_map_calibration(rs2::frame_queue left, rs2::frame_queue color, rs2::frame_queue depth, int py_px_only, float *health, int health_size) const
Definition: rs_device.hpp:641
calibration_table run_on_chip_calibration(std::string json_content, float *health, int timeout_ms=5000) const
Definition: rs_device.hpp:424
float calculate_target_z(rs2::frame_queue queue1, rs2::frame_queue queue2, rs2::frame_queue queue3, float target_width, float target_height, T callback) const
Definition: rs_device.hpp:726
void set_calibration_table(const calibration_table &calibration)
Definition: rs_device.hpp:557
std::vector< uint8_t > run_uv_map_calibration(rs2::frame_queue left, rs2::frame_queue color, rs2::frame_queue depth, int py_px_only, float *health, int health_size, T callback) const
Definition: rs_device.hpp:675
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms=5000) const
Definition: rs_device.hpp:509
calibration_table run_on_chip_calibration(std::string json_content, float *health, T callback, int timeout_ms=5000) const
Definition: rs_device.hpp:372
Definition: rs_device.hpp:297
calibrated_device(device d)
Definition: rs_device.hpp:299
void write_calibration() const
Definition: rs_device.hpp:306
void reset_to_factory_calibration()
Definition: rs_device.hpp:316
Definition: rs_device.hpp:743
calibration_change_callback(callback cb)
Definition: rs_device.hpp:747
void on_calibration_change(rs2_calibration_status status) noexcept override
Definition: rs_device.hpp:749
void release() override
Definition: rs_device.hpp:753
Definition: rs_device.hpp:757
calibration_change_device(device d)
Definition: rs_device.hpp:760
void register_calibration_change_callback(T callback)
Definition: rs_device.hpp:780
Definition: rs_context.hpp:97
Definition: rs_device.hpp:820
debug_protocol(device d)
Definition: rs_device.hpp:822
std::vector< uint8_t > send_and_receive_raw_data(const std::vector< uint8_t > &input) const
Definition: rs_device.hpp:833
Definition: rs_device.hpp:795
void trigger_device_calibration(rs2_calibration_type type)
Definition: rs_device.hpp:811
device_calibration(device d)
Definition: rs_device.hpp:798
Definition: rs_context.hpp:225
Definition: rs_device.hpp:910
device_list_iterator & operator++()
Definition: rs_device.hpp:932
device operator*() const
Definition: rs_device.hpp:920
bool operator==(const device_list_iterator &other) const
Definition: rs_device.hpp:928
bool operator!=(const device_list_iterator &other) const
Definition: rs_device.hpp:924
Definition: rs_device.hpp:855
device_list(std::shared_ptr< rs2_device_list > list)
Definition: rs_device.hpp:857
device back() const
Definition: rs_device.hpp:904
device operator[](uint32_t index) const
Definition: rs_device.hpp:884
bool contains(const device &dev) const
Definition: rs_device.hpp:870
device_list & operator=(std::shared_ptr< rs2_device_list > list)
Definition: rs_device.hpp:878
uint32_t size() const
Definition: rs_device.hpp:895
device_list_iterator end() const
Definition: rs_device.hpp:947
device front() const
Definition: rs_device.hpp:903
const rs2_device_list * get_list() const
Definition: rs_device.hpp:951
device_list_iterator begin() const
Definition: rs_device.hpp:943
device_list()
Definition: rs_device.hpp:860
Definition: rs_device.hpp:19
device(std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:139
virtual ~device()
Definition: rs_device.hpp:134
void hardware_reset()
Definition: rs_device.hpp:90
T as() const
Definition: rs_device.hpp:129
T first() const
Definition: rs_device.hpp:52
device & operator=(const std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:98
device & operator=(const device &dev)
Definition: rs_device.hpp:104
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
bool is() const
Definition: rs_device.hpp:122
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:146
std::vector< sensor > query_sensors() const
Definition: rs_device.hpp:25
const char * get_info(rs2_camera_info info) const
Definition: rs_device.hpp:79
device()
Definition: rs_device.hpp:110
bool supports(rs2_camera_info info) const
Definition: rs_device.hpp:66
Definition: rs_types.hpp:93
static void handle(rs2_error *e)
Definition: rs_types.hpp:144
Definition: rs_sensor.hpp:406
Definition: rs_processing.hpp:135
std::shared_ptr< rs2_frame_queue > get()
Definition: rs_processing.hpp:240
Definition: rs_sensor.hpp:390
Definition: rs_pipeline.hpp:19
Definition: rs_sensor.hpp:103
const std::shared_ptr< rs2_sensor > & get() const
Definition: rs_sensor.hpp:320
Definition: rs_device.hpp:972
void disconnect_controller(int id)
Definition: rs_device.hpp:1033
void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic &motion_intriniscs)
Definition: rs_device.hpp:1075
void connect_controller(const std::array< uint8_t, 6 > &mac_addr)
Definition: rs_device.hpp:1022
void disable_loopback()
Definition: rs_device.hpp:999
bool is_loopback_enabled() const
Definition: rs_device.hpp:1010
void enable_loopback(const std::string &from_file)
Definition: rs_device.hpp:989
void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics &extrinsics)
Definition: rs_device.hpp:1061
void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics &intrinsics)
Definition: rs_device.hpp:1045
tm2(device d)
Definition: rs_device.hpp:974
Definition: rs_device.hpp:167
bool check_firmware_compatibility(const std::vector< uint8_t > &image) const
Definition: rs_device.hpp:233
updatable()
Definition: rs_device.hpp:169
std::vector< uint8_t > create_flash_backup() const
Definition: rs_device.hpp:191
void enter_update_state() const
Definition: rs_device.hpp:182
void update_unsigned(const std::vector< uint8_t > &image, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
Definition: rs_device.hpp:242
updatable(device d)
Definition: rs_device.hpp:170
void update_unsigned(const std::vector< uint8_t > &image, T callback, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
Definition: rs_device.hpp:251
std::vector< uint8_t > create_flash_backup(T callback) const
Definition: rs_device.hpp:212
Definition: rs_device.hpp:260
update_device()
Definition: rs_device.hpp:262
update_device(device d)
Definition: rs_device.hpp:263
void update(const std::vector< uint8_t > &fw_image) const
Definition: rs_device.hpp:276
void update(const std::vector< uint8_t > &fw_image, T callback) const
Definition: rs_device.hpp:286
Definition: rs_device.hpp:152
void release() override
Definition: rs_device.hpp:163
update_progress_callback(T callback)
Definition: rs_device.hpp:156
void on_update_progress(const float progress) override
Definition: rs_device.hpp:158
Definition: rs_processing_gl.hpp:13
std::vector< uint8_t > calibration_table
Definition: rs_device.hpp:294
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
rs2_device * rs2_create_device(const rs2_device_list *info_list, int index, rs2_error **error)
int rs2_get_device_count(const rs2_device_list *info_list, rs2_error **error)
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)
rs2_calibration_type
Definition: rs_device.h:355
void rs2_trigger_device_calibration(rs2_device *dev, rs2_calibration_type type, rs2_error **error)
void rs2_reset_to_factory_calibration(const rs2_device *device, rs2_error **e)
#define RS2_UNSIGNED_UPDATE_MODE_UPDATE
Definition: rs_device.h:206
void rs2_set_calibration_table(const rs2_device *device, const void *calibration, int calibration_size, rs2_error **error)
void rs2_delete_device(rs2_device *device)
const rs2_raw_data_buffer * rs2_get_calibration_table(const rs2_device *dev, rs2_error **error)
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
void rs2_write_calibration(const rs2_device *device, rs2_error **e)
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
int rs2_check_firmware_compatibility(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_error **error)
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)
void rs2_connect_tm2_controller(const rs2_device *device, const unsigned char *mac_addr, rs2_error **error)
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)
int rs2_loopback_is_enabled(const rs2_device *device, rs2_error **error)
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
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)
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)
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
void rs2_loopback_disable(const rs2_device *device, rs2_error **error)
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
void rs2_loopback_enable(const rs2_device *device, const char *from_file, rs2_error **error)
void rs2_register_calibration_change_callback_cpp(rs2_device *dev, rs2_calibration_change_callback *callback, rs2_error **error)
rs2_calibration_status
Definition: rs_device.h:367
const rs2_raw_data_buffer * rs2_run_uv_map_calibration_cpp(rs2_device *device, rs2_frame_queue *left_queue, rs2_frame_queue *color_queue, rs2_frame_queue *depth_queue, int py_px_only, float *health, int health_size, rs2_update_progress_callback *progress_callback, rs2_error **error)
float rs2_calculate_target_z_cpp(rs2_device *device, rs2_frame_queue *queue1, rs2_frame_queue *queue2, rs2_frame_queue *queue3, float target_width, float target_height, rs2_update_progress_callback *callback, rs2_error **error)
const rs2_raw_data_buffer * rs2_run_focal_length_calibration_cpp(rs2_device *device, rs2_frame_queue *left_queue, rs2_frame_queue *right_queue, float target_width, float target_height, int adjust_both_sides, float *ratio, float *angle, rs2_update_progress_callback *progress_callback, rs2_error **error)
void rs2_disconnect_tm2_controller(const rs2_device *device, int id, rs2_error **error)
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43
@ RS2_STREAM_FISHEYE
Definition: rs_sensor.h:48
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
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)
void rs2_delete_sensor(rs2_sensor *sensor)
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
int rs2_get_sensors_count(const rs2_sensor_list *info_list, rs2_error **error)
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
Definition: rs_sensor.h:22
void rs2_set_motion_device_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
void rs2_set_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_intrinsics *intrinsics, rs2_error **error)
@ RS2_EXTENSION_DEBUG
Definition: rs_types.h:169
@ RS2_EXTENSION_UPDATABLE
Definition: rs_types.h:205
@ RS2_EXTENSION_AUTO_CALIBRATED_DEVICE
Definition: rs_types.h:209
@ RS2_EXTENSION_TM2
Definition: rs_types.h:190
@ RS2_EXTENSION_DEVICE_CALIBRATION
Definition: rs_types.h:217
@ RS2_EXTENSION_UPDATE_DEVICE
Definition: rs_types.h:206
@ RS2_EXTENSION_CALIBRATION_CHANGE_DEVICE
Definition: rs_types.h:223
struct rs2_device_list rs2_device_list
Definition: rs_types.h:267
struct rs2_error rs2_error
Definition: rs_types.h:259
Definition: rs_types.hpp:63
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition: rs_sensor.h:98
Video stream intrinsics.
Definition: rs_types.h:59
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:104
Definition: rs_types.hpp:84