complementary_filter_ros.h
Go to the documentation of this file.
1 /*
2  @author Roberto G. Valenti <robertogl.valenti@gmail.com>
3 
4  @section LICENSE
5  Copyright (c) 2015, City University of New York
6  CCNY Robotics Lab <http://robotics.ccny.cuny.edu>
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11  1. Redistributions of source code must retain the above copyright
12  notice, this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16  3. Neither the name of the City College of New York nor the
17  names of its contributors may be used to endorse or promote products
18  derived from this software without specific prior written permission.
19 
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23  DISCLAIMED. IN NO EVENT SHALL the CCNY ROBOTICS LAB BE LIABLE FOR ANY
24  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32 #ifndef IMU_TOOLS_COMPLEMENTARY_FILTER_ROS_H
33 #define IMU_TOOLS_COMPLEMENTARY_FILTER_ROS_H
34 
35 #include <sensor_msgs/MagneticField.h>
36 #include <geometry_msgs/Vector3Stamped.h>
40 #include <ros/ros.h>
41 #include <sensor_msgs/Imu.h>
42 #include <tf/transform_datatypes.h>
44 
46 
47 namespace imu_tools {
48 
50 {
51  public:
53  const ros::NodeHandle& nh_private);
54  virtual ~ComplementaryFilterROS();
55 
56  private:
57 
58  // Convenience typedefs
59  typedef sensor_msgs::Imu ImuMsg;
60  typedef sensor_msgs::MagneticField MagMsg;
61  typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Imu,
62  MagMsg> MySyncPolicy;
68 
69  // ROS-related variables.
72 
76 
81 
82  // Parameters:
83  bool use_mag_;
86  double constant_dt_;
88  std::string fixed_frame_;
90 
91  // State variables:
95 
96  void initializeParams();
97  void imuCallback(const ImuMsg::ConstPtr& imu_msg_raw);
98  void imuMagCallback(const ImuMsg::ConstPtr& imu_msg_raw,
99  const MagMsg::ConstPtr& mav_msg);
100  void publish(const sensor_msgs::Imu::ConstPtr& imu_msg_raw);
101 
103  double q0, double q1, double q2, double q3) const;
104 };
105 
106 } // namespace imu_tools
107 
108 #endif // IMU_TOOLS_COMPLEMENTARY_FILTER_ROS_H
message_filters::sync_policies::ApproximateTime< sensor_msgs::Imu, MagMsg > MySyncPolicy
boost::shared_ptr< ImuSubscriber > imu_subscriber_
boost::shared_ptr< MagSubscriber > mag_subscriber_
boost::shared_ptr< Synchronizer > sync_
void imuCallback(const ImuMsg::ConstPtr &imu_msg_raw)
message_filters::sync_policies::ApproximateTime< ImuMsg, MagMsg > SyncPolicy
message_filters::Subscriber< MagMsg > MagSubscriber
tf::Quaternion hamiltonToTFQuaternion(double q0, double q1, double q2, double q3) const
ComplementaryFilterROS(const ros::NodeHandle &nh, const ros::NodeHandle &nh_private)
void imuMagCallback(const ImuMsg::ConstPtr &imu_msg_raw, const MagMsg::ConstPtr &mav_msg)
message_filters::Synchronizer< SyncPolicy > Synchronizer
void publish(const sensor_msgs::Imu::ConstPtr &imu_msg_raw)
message_filters::Subscriber< ImuMsg > ImuSubscriber


imu_complementary_filter
Author(s): Roberto G. Valenti
autogenerated on Tue May 7 2019 03:16:52