cm_740_module.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2017 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
17 /* Author: Kayman */
18 
19 #ifndef OP3_CM_740_MODULE_H_
20 #define OP3_CM_740_MODULE_H_
21 
22 #include <ros/ros.h>
23 #include <ros/callback_queue.h>
24 #include <std_msgs/String.h>
25 #include <sensor_msgs/Imu.h>
26 #include <boost/thread.hpp>
27 #include <eigen3/Eigen/Eigen>
28 
29 #include "robotis_controller_msgs/StatusMsg.h"
33 
34 namespace robotis_op
35 {
36 
38 {
39  public:
40  CM740Module();
41  virtual ~CM740Module();
42 
43  /* ROS Topic Callback Functions */
44  void initialize(const int control_cycle_msec, robotis_framework::Robot *robot);
45  void process(std::map<std::string, robotis_framework::Dynamixel *> dxls,
46  std::map<std::string, robotis_framework::Sensor *> sensors);
47 
48  private:
49  const bool DEBUG_PRINT;
50  const double G_ACC = 9.80665;
51 
52  void queueThread();
53 
54  double getGyroValue(int raw_value);
55  double getAccValue(int raw_value);
56  void fusionIMU();
57 
58  void handleButton(const std::string &button_name);
59  void publishButtonMsg(const std::string &button_name);
60  void handleVoltage(double present_volt);
61  void publishStatusMsg(unsigned int type, std::string msg);
62  double lowPassFilter(double alpha, double x_new, double x_old);
63 
65  boost::thread queue_thread_;
66  std::map<std::string, bool> buttons_;
67  std::map<std::string, ros::Time> buttons_press_time_;
71  double present_volt_;
72 
73  sensor_msgs::Imu imu_msg_;
74 
75  /* subscriber & publisher */
79 };
80 
81 }
82 
83 #endif /* OP3_CM_740_MODULE_H_ */
ros::Publisher status_msg_pub_
Definition: cm_740_module.h:78
void publishStatusMsg(unsigned int type, std::string msg)
std::map< std::string, bool > buttons_
Definition: cm_740_module.h:66
boost::thread queue_thread_
Definition: cm_740_module.h:65
ros::Publisher button_pub_
Definition: cm_740_module.h:77
std::map< std::string, ros::Time > buttons_press_time_
Definition: cm_740_module.h:67
double lowPassFilter(double alpha, double x_new, double x_old)
void publishButtonMsg(const std::string &button_name)
void handleVoltage(double present_volt)
void process(std::map< std::string, robotis_framework::Dynamixel * > dxls, std::map< std::string, robotis_framework::Sensor * > sensors)
double getAccValue(int raw_value)
void initialize(const int control_cycle_msec, robotis_framework::Robot *robot)
double getGyroValue(int raw_value)
sensor_msgs::Imu imu_msg_
Definition: cm_740_module.h:73
ros::Publisher imu_pub_
Definition: cm_740_module.h:76
void handleButton(const std::string &button_name)


cm_740_module
Author(s): Kayman
autogenerated on Mon Jun 10 2019 14:41:03