ellipse_mag.cpp
Go to the documentation of this file.
1 #include "ellipse.h"
2 #include <ros/ros.h>
3 #include <std_srvs/SetBool.h>
4 #include <std_srvs/Trigger.h>
5 
7 bool start_calibration = true;
8 bool one_calibration_done = false;
9 
10 bool calibration_process(std_srvs::Trigger::Request &req,
11  std_srvs::Trigger::Response &res){
13  res.success = e_ref->start_mag_calibration();
14  res.message = "Start Calibration process";
15  start_calibration = false;
16  }
17  else{
18  res.success = e_ref->end_mag_calibration();
19  res.message = "End Calibration process (see console to get info)";
20  start_calibration = true;
21  one_calibration_done = true;
22  }
23  return true;
24 }
25 
26 bool calibration_save(std_srvs::Trigger::Request &req,
27  std_srvs::Trigger::Response &res){
29  res.success = e_ref->save_mag_calibration();
30  res.message = "Calibration saved";
31  e_ref->save_config();
32  }
33  else{
34  res.success = false;
35  res.message = "No Calibration found";
36  }
37  return true;
38 }
39 
40 int main(int argc, char **argv)
41 {
42  ros::init(argc, argv, "sbg_ellipse_mag");
44 
45  ROS_INFO("SBG DRIVER - Init node & load params");
46  Ellipse ellipse(&n);
47  e_ref = &ellipse;
48 
49  ROS_INFO("SBG DRIVER - Ellipse connect");
50  ellipse.connect();
51 
52  ros::ServiceServer calibration_srv = n.advertiseService("mag_calibration", calibration_process);
53  ros::ServiceServer calibration_save_srv = n.advertiseService("mag_calibration_save", calibration_save);
54  ros::spin();
55 
56  return 0;
57 }
bool end_mag_calibration()
Definition: ellipse.cpp:820
bool save_mag_calibration()
Definition: ellipse.cpp:897
bool start_calibration
Definition: ellipse_mag.cpp:7
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool calibration_process(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
Definition: ellipse_mag.cpp:10
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
int main(int argc, char **argv)
Definition: ellipse_mag.cpp:40
bool one_calibration_done
Definition: ellipse_mag.cpp:8
bool start_mag_calibration()
Definition: ellipse.cpp:807
#define ROS_INFO(...)
ROSCPP_DECL void spin()
void save_config()
Definition: ellipse.cpp:122
bool calibration_save(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
Definition: ellipse_mag.cpp:26
Ellipse * e_ref
Definition: ellipse_mag.cpp:6
void connect()
Definition: ellipse.cpp:39


sbg_driver
Author(s):
autogenerated on Sun Jan 27 2019 03:42:19