d400-options.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "d400-private.h"
7 #include "ds/ds-options.h"
8 
9 #include "algo.h"
10 #include "error-handling.h"
11 #include "../../hdr-config.h"
12 
13 #include <rsutils/lazy.h>
14 
15 
16 namespace librealsense
17 {
18 
20  {
21  public:
22  float query() const override;
23 
24  option_range get_range() const override;
25 
26  inline bool is_enabled() const override {return true;}
27 
28  inline const char* get_description() const override {return "Current Asic Temperature (degree celsius)";}
29 
30  explicit asic_temperature_option_mipi(std::shared_ptr<hw_monitor> hwm, rs2_option opt);
31 
32  private:
34  std::shared_ptr<hw_monitor> _hw_monitor;
35  };
36 
38  {
39  public:
40  float query() const override;
41 
42  option_range get_range() const override;
43 
44  inline bool is_enabled() const override {return true;}
45 
46  inline const char* get_description() const override {return "Current Projector Temperature (degree celsius)";}
47 
48  explicit projector_temperature_option_mipi(std::shared_ptr<hw_monitor> hwm, rs2_option opt);
49 
50  private:
52  std::shared_ptr<hw_monitor> _hw_monitor;
53  };
54 
55  class limits_option;
56 
58  {
59  public:
61  const std::weak_ptr< sensor_base > & depth_ep,
63  std::shared_ptr< limits_option > exposure_limit_enable,
64  bool ae_gain_limits_new_opcode = false );
65  virtual ~auto_exposure_limit_option() = default;
66  virtual void set(float value) override;
67  virtual float query() const override;
68  virtual option_range get_range() const override;
69  virtual bool is_enabled() const override { return true; }
70  virtual bool is_read_only() const override;
71  virtual const char* get_description() const override
72  {
73  return "Exposure limit is in microseconds. If the requested exposure limit is greater than frame time, it will be set to frame time at runtime. Setting will not take effect until next streaming session.";
74  }
75  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
76  void set_using_new_opcode( float value );
77  void set_using_old_opcode( float value );
78  float query_using_new_opcode() const;
79  float query_using_old_opcode() const;
80 
81  private:
82  std::function<void(const option&)> _record_action = [](const option&) {};
85  std::weak_ptr< sensor_base > _sensor;
86  std::weak_ptr<limits_option> _exposure_limit_toggle;
88  };
89 
91  {
92  public:
94  const std::weak_ptr< sensor_base > & depth_ep,
96  std::shared_ptr< limits_option > gain_limit_enable,
97  bool new_opcode = false );
98  virtual ~auto_gain_limit_option() = default;
99  virtual void set(float value) override;
100  virtual float query() const override;
101  virtual option_range get_range() const override;
102  virtual bool is_enabled() const override { return true; }
103  virtual bool is_read_only() const override;
104  virtual const char* get_description() const override
105  {
106  return "Gain limits ranges from 16 to 248. If the requested gain limit is less than 16, it will be set to 16. If the requested gain limit is greater than 248, it will be set to 248. Setting will not take effect until next streaming session.";
107  }
108  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
109  void set_using_new_opcode( float value );
110  void set_using_old_opcode( float value );
111  float query_using_new_opcode() const;
112  float query_using_old_opcode() const;
113 
114  private:
115  std::function<void(const option&)> _record_action = [](const option&) {};
118  std::weak_ptr< sensor_base > _sensor;
119  std::weak_ptr<limits_option> _gain_limit_toggle;
121  };
122 
123  // Auto-Limits Enable/ Disable
124  class limits_option : public option
125  {
126  public:
127 
130  const char * description,
131  hw_monitor & hwm,
132  bool new_opcode = false );
133  virtual void set(float value) override;
134  virtual float query() const override;
135  virtual option_range get_range() const override { return _toggle_range; };
136  virtual bool is_enabled() const override { return true; }
137  virtual const char* get_description() const override { return _description; };
138  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
139  virtual const char* get_value_description(float val) const override
140  {
142  return _description_per_value.at(val).c_str();
143  return nullptr;
144  };
146  float get_cached_limit() { return _cached_limit; };
147  void set_using_new_opcode( float value, float set_limit );
148  void set_using_old_opcode( float value, float set_limit );
149  std::vector< uint8_t > query_using_new_opcode() const;
150  std::vector< uint8_t > query_using_old_opcode() const;
151 
152  private:
153  std::function<void(const option&)> _record_action = [](const option&) {};
156  const std::map<float, std::string> _description_per_value;
157  float _cached_limit; // used to cache contol limit value when toggle is switched to off
158  const char* _description;
160  bool _new_opcode;
161  };
162 
163  class d400_thermal_monitor;
165  {
166  public:
167  thermal_compensation(std::shared_ptr<d400_thermal_monitor> monitor,
168  std::shared_ptr<option> toggle);
169 
170  void set(float value) override;
171  float query() const override;
172 
173  option_range get_range() const override { return option_range{ 0, 1, 1, 0 }; }
174  bool is_enabled() const override { return true; }
175 
176  const char* get_description() const override;
177  const char* get_value_description(float value) const override;
178  void create_snapshot(std::shared_ptr<option>& snapshot) const override;
179 
180  void enable_recording(std::function<void(const option&)> record_action) override
181  {
182  _recording_function = record_action;
183  }
184 
185  private:
186  std::shared_ptr<d400_thermal_monitor> _thermal_monitor;
187  std::shared_ptr<option> _thermal_toggle;
188 
189  std::function<void(const option&)> _recording_function = [](const option&) {};
190  };
191 
192 
193  class hid_sensor;
195  {
196  public:
197  gyro_sensitivity_option( const std::weak_ptr< hid_sensor > & sensor, const option_range & opt_range )
198  : option_base( opt_range )
199  , _value( opt_range.def )
200  , _sensor( sensor )
201  {
202  set( _value );
203  }
204  virtual ~gyro_sensitivity_option() = default;
205  virtual void set( float value ) override;
206  virtual float query() const override;
207  virtual bool is_enabled() const override { return true; }
208  virtual const char * get_description() const override;
209  const char * get_value_description( float value ) const override;
210  virtual void enable_recording( std::function< void( const option & ) > record_action ) override
211  {
212  _record_action = record_action;
213  }
214  virtual bool is_read_only() const override;
215 
216  private:
217  float _value;
218  std::weak_ptr< hid_sensor > _sensor;
219  std::function< void( const option & ) > _record_action = []( const option & ) {};
220 
221  };
222 }
librealsense::gyro_sensitivity_option
Definition: d400-options.h:194
librealsense
Definition: algo.h:18
d400-private.h
librealsense::auto_exposure_limit_option::_range
rsutils::lazy< option_range > _range
Definition: d400-options.h:83
librealsense::auto_exposure_limit_option::get_range
virtual option_range get_range() const override
Definition: d400-options.cpp:122
librealsense::projector_temperature_option_mipi::get_range
option_range get_range() const override
Definition: d400-options.cpp:65
librealsense::thermal_compensation::_thermal_monitor
std::shared_ptr< d400_thermal_monitor > _thermal_monitor
Definition: d400-options.h:186
librealsense::limits_option::_description
const char * _description
Definition: d400-options.h:158
librealsense::auto_exposure_limit_option::is_enabled
virtual bool is_enabled() const override
Definition: d400-options.h:69
librealsense::asic_temperature_option_mipi::query
float query() const override
Definition: d400-options.cpp:18
librealsense::auto_gain_limit_option::_gain_limit_toggle
std::weak_ptr< limits_option > _gain_limit_toggle
Definition: d400-options.h:119
librealsense::asic_temperature_option_mipi
Definition: d400-options.h:19
librealsense::limits_option::enable_recording
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: d400-options.h:138
librealsense::auto_gain_limit_option::is_enabled
virtual bool is_enabled() const override
Definition: d400-options.h:102
librealsense::auto_exposure_limit_option::enable_recording
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: d400-options.h:75
librealsense::option_base
Definition: option.h:91
librealsense::limits_option::_toggle_range
option_range _toggle_range
Definition: d400-options.h:155
rsutils::lazy
Definition: lazy.h:16
test-librs-device-properties.sensor
sensor
Definition: test-librs-device-properties.py:40
ds-options.h
librealsense::gyro_sensitivity_option::_value
float _value
Definition: d400-options.h:217
librealsense::auto_exposure_limit_option::set_using_old_opcode
void set_using_old_opcode(float value)
Definition: d400-options.cpp:152
librealsense::gyro_sensitivity_option::is_read_only
virtual bool is_read_only() const override
Definition: d400-options.cpp:522
librealsense::limits_option::_record_action
std::function< void(const option &)> _record_action
Definition: d400-options.h:153
librealsense::auto_gain_limit_option::enable_recording
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: d400-options.h:108
librealsense::limits_option::_new_opcode
bool _new_opcode
Definition: d400-options.h:160
librealsense::asic_temperature_option_mipi::get_range
option_range get_range() const override
Definition: d400-options.cpp:37
librealsense::auto_gain_limit_option::set_using_new_opcode
void set_using_new_opcode(float value)
Definition: d400-options.cpp:258
librealsense::limits_option::get_description
virtual const char * get_description() const override
Definition: d400-options.h:137
librealsense::readonly_option
Definition: option.h:40
librealsense::asic_temperature_option_mipi::asic_temperature_option_mipi
asic_temperature_option_mipi(std::shared_ptr< hw_monitor > hwm, rs2_option opt)
Definition: d400-options.cpp:14
librealsense::limits_option::query_using_new_opcode
std::vector< uint8_t > query_using_new_opcode() const
Definition: d400-options.cpp:410
librealsense::limits_option::query_using_old_opcode
std::vector< uint8_t > query_using_old_opcode() const
Definition: d400-options.cpp:417
librealsense::limits_option::query
virtual float query() const override
Definition: d400-options.cpp:337
librealsense::limits_option::set_using_old_opcode
void set_using_old_opcode(float value, float set_limit)
Definition: d400-options.cpp:388
librealsense::limits_option::_cached_limit
float _cached_limit
Definition: d400-options.h:157
void
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
librealsense::auto_exposure_limit_option::get_description
virtual const char * get_description() const override
Definition: d400-options.h:71
librealsense::asic_temperature_option_mipi::_hw_monitor
std::shared_ptr< hw_monitor > _hw_monitor
Definition: d400-options.h:34
librealsense::thermal_compensation::_thermal_toggle
std::shared_ptr< option > _thermal_toggle
Definition: d400-options.h:187
librealsense::gyro_sensitivity_option::~gyro_sensitivity_option
virtual ~gyro_sensitivity_option()=default
librealsense::auto_gain_limit_option::query
virtual float query() const override
Definition: d400-options.cpp:234
librealsense::auto_exposure_limit_option::_exposure_limit_toggle
std::weak_ptr< limits_option > _exposure_limit_toggle
Definition: d400-options.h:86
algo.h
lazy.h
librealsense::limits_option::get_value_description
virtual const char * get_value_description(float val) const override
Definition: d400-options.h:139
librealsense::auto_exposure_limit_option::set_using_new_opcode
void set_using_new_opcode(float value)
Definition: d400-options.cpp:134
librealsense::limits_option::set_using_new_opcode
void set_using_new_opcode(float value, float set_limit)
Definition: d400-options.cpp:364
librealsense::auto_gain_limit_option::_range
rsutils::lazy< option_range > _range
Definition: d400-options.h:116
librealsense::hw_monitor
Definition: hw-monitor.h:271
librealsense::option_range
Definition: option-interface.h:14
val
GLuint GLfloat * val
Definition: glad/glad/glad.h:3411
librealsense::thermal_compensation::query
float query() const override
Definition: d400-options.cpp:432
librealsense::gyro_sensitivity_option::enable_recording
virtual void enable_recording(std::function< void(const option &) > record_action) override
Definition: d400-options.h:210
librealsense::auto_gain_limit_option
Definition: d400-options.h:90
librealsense::projector_temperature_option_mipi::projector_temperature_option_mipi
projector_temperature_option_mipi(std::shared_ptr< hw_monitor > hwm, rs2_option opt)
Definition: d400-options.cpp:42
librealsense::gyro_sensitivity_option::set
virtual void set(float value) override
Definition: d400-options.cpp:470
librealsense::limits_option
Definition: d400-options.h:124
librealsense::thermal_compensation::enable_recording
void enable_recording(std::function< void(const option &)> record_action) override
Definition: d400-options.h:180
librealsense::thermal_compensation::get_value_description
const char * get_value_description(float value) const override
Definition: d400-options.cpp:452
librealsense::limits_option::get_cached_limit
float get_cached_limit()
Definition: d400-options.h:146
librealsense::gyro_sensitivity_option::get_description
virtual const char * get_description() const override
Definition: d400-options.cpp:517
librealsense::limits_option::limits_option
limits_option(rs2_option option, option_range range, const char *description, hw_monitor &hwm, bool new_opcode=false)
Definition: d400-options.cpp:317
librealsense::auto_gain_limit_option::query_using_new_opcode
float query_using_new_opcode() const
Definition: d400-options.cpp:291
value
GLfloat value
Definition: glad/glad/glad.h:2099
librealsense::thermal_compensation::create_snapshot
void create_snapshot(std::shared_ptr< option > &snapshot) const override
Definition: d400-options.cpp:465
librealsense::limits_option::set
virtual void set(float value) override
Definition: d400-options.cpp:325
librealsense::projector_temperature_option_mipi::_option
rs2_option _option
Definition: d400-options.h:51
librealsense::asic_temperature_option_mipi::get_description
const char * get_description() const override
Definition: d400-options.h:28
librealsense::auto_exposure_limit_option::query_using_new_opcode
float query_using_new_opcode() const
Definition: d400-options.cpp:168
toggle
Definition: rs-measure.cpp:24
librealsense::auto_gain_limit_option::_hwm
hw_monitor & _hwm
Definition: d400-options.h:117
librealsense::auto_exposure_limit_option::_sensor
std::weak_ptr< sensor_base > _sensor
Definition: d400-options.h:85
librealsense::auto_exposure_limit_option::auto_exposure_limit_option
auto_exposure_limit_option(hw_monitor &hwm, const std::weak_ptr< sensor_base > &depth_ep, option_range range, std::shared_ptr< limits_option > exposure_limit_enable, bool ae_gain_limits_new_opcode=false)
Definition: d400-options.cpp:70
librealsense::auto_gain_limit_option::auto_gain_limit_option
auto_gain_limit_option(hw_monitor &hwm, const std::weak_ptr< sensor_base > &depth_ep, option_range range, std::shared_ptr< limits_option > gain_limit_enable, bool new_opcode=false)
Definition: d400-options.cpp:193
librealsense::limits_option::is_enabled
virtual bool is_enabled() const override
Definition: d400-options.h:136
librealsense::auto_exposure_limit_option::set
virtual void set(float value) override
Definition: d400-options.cpp:89
librealsense::auto_gain_limit_option::get_range
virtual option_range get_range() const override
Definition: d400-options.cpp:246
rs2_option
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls,...
Definition: rs_option.h:26
librealsense::auto_gain_limit_option::set_using_old_opcode
void set_using_old_opcode(float value)
Definition: d400-options.cpp:276
librealsense::gyro_sensitivity_option::gyro_sensitivity_option
gyro_sensitivity_option(const std::weak_ptr< hid_sensor > &sensor, const option_range &opt_range)
Definition: d400-options.h:197
librealsense::auto_exposure_limit_option::is_read_only
virtual bool is_read_only() const override
Definition: d400-options.cpp:127
librealsense::limits_option::set_cached_limit
void set_cached_limit(float value)
Definition: d400-options.h:145
librealsense::auto_exposure_limit_option::_new_opcode
bool _new_opcode
Definition: d400-options.h:87
librealsense::gyro_sensitivity_option::query
virtual float query() const override
Definition: d400-options.cpp:487
librealsense::thermal_compensation::get_range
option_range get_range() const override
Definition: d400-options.h:173
librealsense::thermal_compensation::thermal_compensation
thermal_compensation(std::shared_ptr< d400_thermal_monitor > monitor, std::shared_ptr< option > toggle)
Definition: d400-options.cpp:424
librealsense::auto_exposure_limit_option::query
virtual float query() const override
Definition: d400-options.cpp:110
librealsense::auto_exposure_limit_option::_hwm
hw_monitor & _hwm
Definition: d400-options.h:84
librealsense::auto_gain_limit_option::set
virtual void set(float value) override
Definition: d400-options.cpp:213
librealsense::auto_exposure_limit_option
Definition: d400-options.h:57
librealsense::auto_gain_limit_option::query_using_old_opcode
float query_using_old_opcode() const
Definition: d400-options.cpp:304
librealsense::gyro_sensitivity_option::get_value_description
const char * get_value_description(float value) const override
Definition: d400-options.cpp:493
librealsense::gyro_sensitivity_option::is_enabled
virtual bool is_enabled() const override
Definition: d400-options.h:207
librealsense::thermal_compensation::set
void set(float value) override
Definition: d400-options.cpp:438
librealsense::projector_temperature_option_mipi
Definition: d400-options.h:37
librealsense::thermal_compensation::is_enabled
bool is_enabled() const override
Definition: d400-options.h:174
librealsense::auto_gain_limit_option::is_read_only
virtual bool is_read_only() const override
Definition: d400-options.cpp:251
librealsense::auto_gain_limit_option::_new_opcode
bool _new_opcode
Definition: d400-options.h:120
librealsense::auto_gain_limit_option::~auto_gain_limit_option
virtual ~auto_gain_limit_option()=default
librealsense::projector_temperature_option_mipi::query
float query() const override
Definition: d400-options.cpp:46
librealsense::thermal_compensation
Definition: d400-options.h:164
librealsense::auto_gain_limit_option::get_description
virtual const char * get_description() const override
Definition: d400-options.h:104
librealsense::auto_exposure_limit_option::~auto_exposure_limit_option
virtual ~auto_exposure_limit_option()=default
librealsense::asic_temperature_option_mipi::is_enabled
bool is_enabled() const override
Definition: d400-options.h:26
librealsense::option
Definition: option-interface.h:22
librealsense::limits_option::_option
rs2_option _option
Definition: d400-options.h:154
librealsense::limits_option::get_range
virtual option_range get_range() const override
Definition: d400-options.h:135
range
GLsizei range
Definition: glad/glad/glad.h:1535
librealsense::auto_gain_limit_option::_sensor
std::weak_ptr< sensor_base > _sensor
Definition: d400-options.h:118
librealsense::projector_temperature_option_mipi::get_description
const char * get_description() const override
Definition: d400-options.h:46
librealsense::gyro_sensitivity_option::_sensor
std::weak_ptr< hid_sensor > _sensor
Definition: d400-options.h:218
librealsense::limits_option::_description_per_value
const std::map< float, std::string > _description_per_value
Definition: d400-options.h:156
librealsense::asic_temperature_option_mipi::_option
rs2_option _option
Definition: d400-options.h:33
librealsense::auto_exposure_limit_option::query_using_old_opcode
float query_using_old_opcode() const
Definition: d400-options.cpp:181
error-handling.h
librealsense::thermal_compensation::_recording_function
std::function< void(const option &)> _recording_function
Definition: d400-options.h:189
librealsense::projector_temperature_option_mipi::is_enabled
bool is_enabled() const override
Definition: d400-options.h:44
librealsense::auto_gain_limit_option::_record_action
std::function< void(const option &)> _record_action
Definition: d400-options.h:115
librealsense::auto_exposure_limit_option::_record_action
std::function< void(const option &)> _record_action
Definition: d400-options.h:82
librealsense::d400_thermal_monitor
Definition: d400-thermal-monitor.h:13
librealsense::gyro_sensitivity_option::_record_action
std::function< void(const option &) > _record_action
Definition: d400-options.h:219
librealsense::projector_temperature_option_mipi::_hw_monitor
std::shared_ptr< hw_monitor > _hw_monitor
Definition: d400-options.h:52
librealsense::limits_option::_hwm
hw_monitor & _hwm
Definition: d400-options.h:159
librealsense::thermal_compensation::get_description
const char * get_description() const override
Definition: d400-options.cpp:447


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:02