SensorConfiguration.cpp
Go to the documentation of this file.
2 
3 namespace rokubimini
4 {
5 namespace configuration
6 {
7 SensorConfiguration::SensorConfiguration(const uint8_t calibrationMatrixActive,
8  const uint8_t temperatureCompensationActive, const uint8_t imuActive,
9  const uint8_t coordinateSystemConfigurationActive,
10  const uint8_t inertiaCompensationActive,
11  const uint8_t orientationEstimationActive)
12  : calibrationMatrixActive_(calibrationMatrixActive)
13  , temperatureCompensationActive_(temperatureCompensationActive)
14  , imuActive_(imuActive)
15  , coordinateSystemConfigurationActive_(coordinateSystemConfigurationActive)
16  , inertiaCompensationActive_(inertiaCompensationActive)
17  , orientationEstimationActive_(orientationEstimationActive)
18 {
19 }
20 
21 bool SensorConfiguration::load(const std::string& key, NodeHandlePtr nh)
22 {
23  bool success = false;
24  std::string local_key;
25  local_key = key + "/calibration_matrix_active";
26  if (nh->hasParam(local_key))
27  {
28  bool calibration_matrix_active;
29  nh->getParam(local_key, calibration_matrix_active);
30  calibrationMatrixActive_ = static_cast<uint8_t>(calibration_matrix_active);
31  success = true;
32  }
33  local_key = key + "/temperature_compensation_active";
34  if (nh->hasParam(local_key))
35  {
36  bool temperature_compensation_active;
37  nh->getParam(local_key, temperature_compensation_active);
38  temperatureCompensationActive_ = static_cast<uint8_t>(temperature_compensation_active);
39  success = true;
40  }
41  local_key = key + "/imu_active";
42  if (nh->hasParam(local_key))
43  {
44  int imu_active;
45  nh->getParam(local_key, imu_active);
46  imuActive_ = static_cast<uint8_t>(imu_active);
47  success = true;
48  }
49  local_key = key + "/coordinate_system_active";
50  if (nh->hasParam(local_key))
51  {
52  bool coordinate_system_active;
53  nh->getParam(local_key, coordinate_system_active);
54  coordinateSystemConfigurationActive_ = static_cast<uint8_t>(coordinate_system_active);
55  success = true;
56  }
57  local_key = key + "/inertia_compensation_active";
58  if (nh->hasParam(local_key))
59  {
60  int inertia_compensation_active;
61  nh->getParam(local_key, inertia_compensation_active);
62  inertiaCompensationActive_ = static_cast<uint8_t>(inertia_compensation_active);
63  success = true;
64  }
65  local_key = key + "/orientation_estimation_active";
66  if (nh->hasParam(local_key))
67  {
68  int orientation_estimation_active;
69  nh->getParam(local_key, orientation_estimation_active);
70  orientationEstimationActive_ = static_cast<uint8_t>(orientation_estimation_active);
71  success = true;
72  }
73  return success;
74 }
75 
77 {
78  ROS_INFO_STREAM("calibrationMatrixActive_: " << static_cast<unsigned int>(calibrationMatrixActive_));
79  ROS_INFO_STREAM("temperatureCompensationActive_: " << static_cast<unsigned int>(temperatureCompensationActive_));
80  ROS_INFO_STREAM("imuActive_: " << static_cast<unsigned int>(imuActive_));
82  "coordinateSystemConfigurationActive_: " << static_cast<unsigned int>(coordinateSystemConfigurationActive_));
83  ROS_INFO_STREAM("inertiaCompensationActive_: " << static_cast<unsigned int>(inertiaCompensationActive_));
84  ROS_INFO_STREAM("orientationEstimationActive_: " << static_cast<unsigned int>(orientationEstimationActive_));
85 }
86 
87 } // namespace configuration
88 } // namespace rokubimini
void print() const
Prints the existing sensor configuration settings.
std::shared_ptr< ros::NodeHandle > NodeHandlePtr
#define ROS_INFO_STREAM(args)
bool load(const std::string &key, NodeHandlePtr nh)
Loads the sensor configuration from the parameter server.
SensorConfiguration()=default
Default constructor.
Tests Configuration.


rokubimini
Author(s):
autogenerated on Wed Mar 3 2021 03:09:12