RealSenseOption.cpp
Go to the documentation of this file.
1 #include "RealSenseOption.h"
2 #include "PCH.h"
3 
4 URealSenseOption::URealSenseOption(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
5 {
6  //REALSENSE_TRACE(TEXT("+URealSenseOption_%p"), this);
7 
8  Range.Min = 0.0f;
9  Range.Max = 1.0f;
10  Range.Step = 0.1f;
11  Range.Default = 0.5f;
12 }
13 
15 {
16  //REALSENSE_TRACE(TEXT("~URealSenseOption_%p"), this);
17 }
18 
20 {
21  RsOptions = Handle; // rs2_options is managed by URealSenseSensor, just keep a pointer
22 }
23 
25 {
26  return RsOptions;
27 }
28 
30 {
31  this->Type = NewType;
32 }
33 
35 {
38  Description = uestr(rs2_get_option_description(RsOptions, (rs2_option)Type, &e));
39  rs2_get_option_range(RsOptions, (rs2_option)Type, &Range.Min, &Range.Max, &Range.Step, &Range.Default, &e);
40  QueryValue();
41 }
42 
44 {
46  Value = rs2_get_option(RsOptions, (rs2_option)Type, &e);
47  if (!e.success())
48  {
49  REALSENSE_ERR(TEXT("rs2_get_option failed: %s"), *uestr(e.get_message()));
50  }
51  return Value;
52 }
53 
54 void URealSenseOption::SetValue(float NewValue)
55 {
56  NewValue = FMath::RoundToFloat(NewValue / Range.Step) * Range.Step;
58  rs2_set_option(RsOptions, (rs2_option)Type, NewValue, &e);
59  if (!e.success())
60  {
61  REALSENSE_ERR(TEXT("rs2_set_option failed: %s"), *uestr(e.get_message()));
62  }
63  this->Value = NewValue;
64 }
float rs2_get_option(const rs2_options *options, rs2_option option, rs2_error **error)
Definition: rs.cpp:628
const char * get_message() const
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
const char * rs2_option_to_string(rs2_option option)
Definition: rs.cpp:1265
ERealSenseOptionType
::sensor_msgs::Range_< std::allocator< void > > Range
Definition: Range.h:75
void SetType(ERealSenseOptionType Type)
#define REALSENSE_ERR(Format,...)
Definition: Shared.h:16
e
Definition: rmse.py:177
bool success() const
IMGUI_API void Value(const char *prefix, bool b)
Definition: imgui.cpp:9538
void rs2_get_option_range(const rs2_options *sensor, rs2_option option, float *min, float *max, float *step, float *def, rs2_error **error)
Definition: rs.cpp:686
void SetHandle(struct rs2_options *Handle)
virtual ~URealSenseOption()
const char * rs2_get_option_description(const rs2_options *options, rs2_option option, rs2_error **error)
Definition: rs.cpp:1007
FString uestr(const char *str)
Definition: Shared.h:38
struct rs2_options * GetHandle()
void SetValue(float Value)
void rs2_set_option(const rs2_options *options, rs2_option option, float value, rs2_error **error)
Definition: rs.cpp:636


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39