pose_estimation_node.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2011, Johannes Meyer, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Flight Systems and Automatic Control group,
13 // TU Darmstadt, nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //=================================================================================================
28 
29 #ifndef HECTOR_POSE_ESTIMATION_NODE_H
30 #define HECTOR_POSE_ESTIMATION_NODE_H
31 
33 
34 #include <ros/ros.h>
35 
36 #include <sensor_msgs/Imu.h>
37 #if defined(USE_MAV_MSGS)
38  #include <mav_msgs/Height.h>
39 #elif defined(USE_HECTOR_UAV_MSGS)
40  #include <hector_uav_msgs/Altimeter.h>
41 #else
42  #include <geometry_msgs/PointStamped.h>
43 #endif
44 #include <sensor_msgs/NavSatFix.h>
45 #include <geometry_msgs/QuaternionStamped.h>
46 #include <geometry_msgs/PoseWithCovarianceStamped.h>
47 #include <geometry_msgs/TwistWithCovarianceStamped.h>
48 #include <geometry_msgs/Vector3Stamped.h>
49 #include <nav_msgs/Odometry.h>
50 #include <std_msgs/String.h>
52 #include <tf/transform_listener.h>
53 
56 
57 namespace hector_pose_estimation {
58 
60 public:
61  PoseEstimationNode(const SystemPtr& system = SystemPtr(), const StatePtr& state = StatePtr());
62  virtual ~PoseEstimationNode();
63 
64  virtual bool init();
65  virtual void reset();
66  virtual void cleanup();
67 
68  virtual void publish();
69 
70 protected:
71  void imuCallback(const sensor_msgs::ImuConstPtr& imu);
72  void ahrsCallback(const sensor_msgs::ImuConstPtr& ahrs);
73  void rollpitchCallback(const sensor_msgs::ImuConstPtr& attitude);
74 
75 #if defined(USE_MAV_MSGS)
76  void heightCallback(const mav_msgs::HeightConstPtr& height);
77 #elif defined(USE_HECTOR_UAV_MSGS)
78  void baroCallback(const hector_uav_msgs::AltimeterConstPtr& altimeter);
79 #else
80  void heightCallback(const geometry_msgs::PointStampedConstPtr& height);
81 #endif
82 
83  void magneticCallback(const geometry_msgs::Vector3StampedConstPtr& magnetic);
84  void gpsCallback(const sensor_msgs::NavSatFixConstPtr& gps, const geometry_msgs::Vector3StampedConstPtr& gps_velocity);
85  void poseupdateCallback(const geometry_msgs::PoseWithCovarianceStampedConstPtr& pose);
86  void twistupdateCallback(const geometry_msgs::TwistWithCovarianceStampedConstPtr& twist);
87  void syscommandCallback(const std_msgs::StringConstPtr& syscommand);
88 
90 
92 
93  virtual ros::NodeHandle& getNodeHandle() { return nh_; }
95 
98 
99 protected:
101 
104 
115 
116  std::vector<tf::StampedTransform> transforms_;
119 
120  std::string tf_prefix_;
123  std::string other_frame_;
124 
126  geometry_msgs::TransformStamped world_nav_transform_;
130 
131  geometry_msgs::PoseStamped sensor_pose_;
133 };
134 
135 } // namespace hector_pose_estimation
136 
137 #endif // HECTOR_POSE_ESTIMATION_NODE_H
message_filters::TimeSynchronizer< sensor_msgs::NavSatFix, geometry_msgs::Vector3Stamped > * gps_synchronizer_
boost::shared_ptr< System > SystemPtr
void twistupdateCallback(const geometry_msgs::TwistWithCovarianceStampedConstPtr &twist)
void syscommandCallback(const std_msgs::StringConstPtr &syscommand)
virtual ros::NodeHandle & getPrivateNodeHandle()
void gpsCallback(const sensor_msgs::NavSatFixConstPtr &gps, const geometry_msgs::Vector3StampedConstPtr &gps_velocity)
tf::TransformBroadcaster * getTransformBroadcaster()
geometry_msgs::TransformStamped world_nav_transform_
void imuCallback(const sensor_msgs::ImuConstPtr &imu)
message_filters::Subscriber< sensor_msgs::NavSatFix > gps_subscriber_
PoseEstimationNode(const SystemPtr &system=SystemPtr(), const StatePtr &state=StatePtr())
std::vector< tf::StampedTransform > transforms_
void poseupdateCallback(const geometry_msgs::PoseWithCovarianceStampedConstPtr &pose)
void ahrsCallback(const sensor_msgs::ImuConstPtr &ahrs)
void publishWorldNavTransform(const ros::TimerEvent &=ros::TimerEvent())
void magneticCallback(const geometry_msgs::Vector3StampedConstPtr &magnetic)
void heightCallback(const geometry_msgs::PointStampedConstPtr &height)
message_filters::Subscriber< geometry_msgs::Vector3Stamped > gps_velocity_subscriber_
boost::shared_ptr< State > StatePtr
void rollpitchCallback(const sensor_msgs::ImuConstPtr &attitude)


hector_pose_estimation
Author(s): Johannes Meyer
autogenerated on Thu Feb 18 2021 03:29:38