Calibration.cpp
Go to the documentation of this file.
2 
4 
5  node.getParam("get_gyroscope_offset", input_command.get_gyroscope_offset);
6  node.getParam("get_accelerometer_calib_params", input_command.get_accelerometer_calib_params);
7  node.getParam("get_magnetometer_calib_params", input_command.get_magnetometer_calib_params);
8 
9 }
10 
11 bool muse_v2_driver::Calibration::getCalibrationParams(GetCalibrationParams::Request& req, GetCalibrationParams::Response& res, MuseV2* muse_v2) {
12  bool out = false;
13 
14  ROS_INFO("request: get_gyroscope_offset=%s, get_accelerometer_calib_params=%s, get_magnetometer_calib_params=%s",
15  req.get_gyroscope_offset ? "true" : "false",
16  req.get_accelerometer_calib_params ? "true" : "false",
17  req.get_magnetometer_calib_params ? "true" : "false"
18  );
19 
20  if (req.get_gyroscope_offset) {
21  if(!received_command.get_gyroscope_offset) {
22  received_command.get_gyroscope_offset = true;
23  ROS_INFO("Asking Gyroscope Offset.");
24  }
25  if (!muse_v2->serial->getGyroscopeOffset().empty()) {
26  for (const auto& value : muse_v2->serial->getGyroscopeOffset())
27  res.current_gyro_offset.push_back(value);
28  out = true;
29  ROS_INFO("Sending back Gyroscope Calib Params.");
30  }
31  }
32 
33  if (req.get_accelerometer_calib_params) {
34  if (!received_command.get_accelerometer_calib_params) {
35  received_command.get_accelerometer_calib_params = true;
36  ROS_INFO("Asking Acceleromter Calibration Params.");
37  }
38  if (!muse_v2->serial->getAccelerometerCalibParams().empty()) {
39  for (auto& value : muse_v2->serial->getAccelerometerCalibParams())
40  res.current_acc_params.push_back(value);
41  out = true;
42  ROS_INFO("Sending back Accelerometer Calib Params.");
43  }
44  }
45 
46  if (req.get_magnetometer_calib_params) {
47  if (!received_command.get_magnetometer_calib_params) {
48  received_command.get_magnetometer_calib_params = true;
49  ROS_INFO("Asking Magnetometer Calibration Params.");
50  }
51  if (!muse_v2->serial->getMagnetometerCalibParams().empty()) {
52  for (auto& value : muse_v2->serial->getMagnetometerCalibParams())
53  res.current_mag_params.push_back(value);
54  out = true;
55  ROS_INFO("Sending back Magnetometer Calib Params.");
56  }
57  }
58 
59  return out;
60 }
muse_v2_driver::Calibration::CommandList::get_accelerometer_calib_params
bool get_accelerometer_calib_params
Definition: Calibration.h:18
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
muse_v2_driver::Calibration::CommandList::get_gyroscope_offset
bool get_gyroscope_offset
Definition: Calibration.h:17
muse_v2_driver::Calibration::CommandList::get_magnetometer_calib_params
bool get_magnetometer_calib_params
Definition: Calibration.h:19
muse_v2_driver::Calibration::getCalibrationParams
bool getCalibrationParams(GetCalibrationParams::Request &req, GetCalibrationParams::Response &res, MuseV2 *muse_v2)
Definition: Calibration.cpp:11
muse_v2_driver::Calibration::input_command
CommandList input_command
Definition: Calibration.h:38
muse_v2_driver::Calibration::setupInputCommands
void setupInputCommands(ros::NodeHandle &node)
Definition: Calibration.cpp:3
muse_v2_driver::MuseV2
Definition: MuseV2.h:21
Calibration.h
ROS_INFO
#define ROS_INFO(...)
muse_v2_driver::MuseV2::serial
MuseV2_SerialConnection * serial
Definition: MuseV2.h:41
ros::NodeHandle


muse_v2_driver
Author(s): Elisa Tosello , Roberto Bortoletto
autogenerated on Thu Jan 20 2022 03:24:53