pfsdp_2000.cpp
Go to the documentation of this file.
2 
4 
5 PFSDP_2000::PFSDP_2000(std::shared_ptr<HandleInfo> info, std::shared_ptr<ScanConfig> config,
6  std::shared_ptr<ScanParameters> params)
7  : PFSDPBase(info, config, params)
8 {
9 }
10 
12 {
13  return get_parameter_str("product");
14 }
15 
17 {
18  auto resp = get_parameter("angular_fov", "radial_range_min", "radial_range_max", "scan_frequency");
19  params_->angular_fov = parser_utils::to_float(resp["angular_fov"]) * M_PI / 180.0;
20  params_->radial_range_max = parser_utils::to_float(resp["radial_range_max"]);
21  params_->radial_range_min = parser_utils::to_float(resp["radial_range_min"]);
22 
23  params_->angle_min = config_->start_angle / 10000.0f * M_PI / 180.0;
24  params_->angle_max = params_->angle_min + params_->angular_fov;
25  params_->scan_freq = parser_utils::to_float(resp["scan_frequency"]);
26 }
27 
29 {
30  param_server_R2000_ = std::make_unique<dynamic_reconfigure::Server<pf_driver::PFDriverR2000Config>>();
31  param_server_R2000_->setCallback(
32  boost::bind(&PFSDP_2000::reconfig_callback, this, boost::placeholders::_1, boost::placeholders::_2));
33 }
34 
35 void PFSDP_2000::reconfig_callback(pf_driver::PFDriverR2000Config& config, uint32_t level)
36 {
37  if (level == 1)
38  {
39  set_parameter({ KV("ip_mode", config.ip_mode) });
40  }
41  else if (level == 2)
42  {
43  set_parameter({ KV("ip_address", config.ip_address) });
44  }
45  else if (level == 3)
46  {
47  set_parameter({ KV("subnet_mask", config.subnet_mask) });
48  }
49  else if (level == 4)
50  {
51  set_parameter({ KV("gateway", config.gateway) });
52  }
53  else if (level == 5)
54  {
55  set_parameter({ KV("scan_frequency", config.scan_frequency) });
56  }
57  else if (level == 6)
58  {
59  set_parameter({ KV("scan_direction", config.scan_direction) });
60  }
61  else if (level == 7)
62  {
63  set_parameter({ KV("samples_per_scan", config.samples_per_scan) });
64  }
65  else if (level == 8)
66  {
67  set_parameter({ KV("hmi_display_mode", config.hmi_display_mode) });
68  }
69  else if (level == 9)
70  {
71  set_parameter({ KV("hmi_language", config.hmi_language) });
72  }
73  else if (level == 10)
74  {
75  set_parameter({ KV("hmi_button_lock", config.hmi_button_lock) });
76  }
77  else if (level == 11)
78  {
79  set_parameter({ KV("hmi_parameter_lock", config.hmi_parameter_lock) });
80  }
81  else if (level == 12)
82  {
83  set_parameter({ KV("hmi_static_text_1", config.hmi_static_text_1) });
84  }
85  else if (level == 13)
86  {
87  set_parameter({ KV("hmi_static_text_2", config.hmi_static_text_2) });
88  }
89  else if (level == 14)
90  {
91  set_parameter({ KV("locator_indication", config.locator_indication) });
92  }
93  else if (level == 15)
94  {
95  set_parameter({ KV("operating_mode", config.operating_mode) });
96  }
97  else if (level == 25)
98  {
99  set_parameter({ KV("user_tag", config.user_tag) });
100  }
101  else if (level == 26)
102  {
103  set_parameter({ KV("user_notes", config.user_notes) });
104  }
105  else if (level == 27)
106  {
107  set_parameter({ KV("hmi_application_bitmap", config.hmi_application_bitmap) });
108  }
109  else if (level == 18)
110  {
111  config_->packet_type = config.packet_type;
112  }
113  else if (level == 19)
114  {
115  // this param doesn't exist for R2000
116  // set_parameter({ KV("packet_crc", config.packet_crc) });
117  }
118  else if (level == 20)
119  {
120  config_->watchdog = (config.watchdog == "on") ? true : false;
121  }
122  else if (level == 21)
123  {
124  config_->watchdogtimeout = config.watchdogtimeout;
125  }
126  else if (level == 22)
127  {
128  config_->start_angle = config.start_angle;
129  }
130  else if (level == 23)
131  {
132  config_->max_num_points_scan = config.max_num_points_scan;
133  }
134  else if (level == 24)
135  {
136  config_->skip_scans = config.skip_scans;
137  }
139 }
float to_float(const std::string &s)
void setup_param_server()
Definition: pfsdp_2000.cpp:28
PFSDP_2000(std::shared_ptr< HandleInfo > info, std::shared_ptr< ScanConfig > config, std::shared_ptr< ScanParameters > params)
Definition: pfsdp_2000.cpp:5
std::string get_parameter_str(const std::string &param)
Definition: pfsdp_base.cpp:168
std::unique_ptr< dynamic_reconfigure::Server< pf_driver::PFDriverR2000Config > > param_server_R2000_
Definition: pfsdp_2000.h:23
virtual std::string get_product()
Definition: pfsdp_2000.cpp:11
std::map< std::string, std::string > get_parameter(const Ts &... ts)
Definition: pfsdp_base.h:83
virtual void get_scan_parameters()
Definition: pfsdp_2000.cpp:16
bool set_parameter(const std::initializer_list< param_type > params)
Definition: pfsdp_base.h:77
Definition: kv.h:9
virtual void reconfig_callback(pf_driver::PFDriverR2000Config &config, uint32_t level)
Definition: pfsdp_2000.cpp:35
bool update_scanoutput_config()
Definition: pfsdp_base.cpp:243
std::shared_ptr< ScanConfig > config_
Definition: pfsdp_base.h:57
std::shared_ptr< ScanParameters > params_
Definition: pfsdp_base.h:58


pf_driver
Author(s): Harsh Deshpande
autogenerated on Fri Feb 24 2023 03:59:35