NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ros_pose_extrapolator_nodelet.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 #ifndef ROS_POSE_EXTRAPOLATOR_ROS_POSE_EXTRAPOLATOR_NODELET_H_
19 #define ROS_POSE_EXTRAPOLATOR_ROS_POSE_EXTRAPOLATOR_NODELET_H_
20 
21 #include <ff_msgs/EkfState.h>
22 #include <ff_msgs/FlightMode.h>
23 #include <ff_msgs/GraphLocState.h>
24 #include <ff_msgs/GraphVIOState.h>
25 #include <ff_msgs/Heartbeat.h>
26 #include <ff_util/ff_nodelet.h>
28 
29 #include <ros/node_handle.h>
30 #include <ros/publisher.h>
31 #include <ros/subscriber.h>
32 #include <sensor_msgs/Imu.h>
33 #include <tf2_ros/transform_broadcaster.h>
34 
35 #include <boost/optional.hpp>
36 
37 #include <string>
38 
39 namespace ros_pose_extrapolator {
41  public:
43 
44  private:
45  void Initialize(ros::NodeHandle* nh) final;
46 
47  void SubscribeAndAdvertise(ros::NodeHandle* nh);
48 
49  void ImuCallback(const sensor_msgs::Imu::ConstPtr& imu_msg);
50 
51  void FlightModeCallback(ff_msgs::FlightMode::ConstPtr const& mode);
52 
53  void LocalizationStateCallback(const ff_msgs::GraphLocState::ConstPtr& graph_loc_state_msg);
54 
55  void GraphVIOStateCallback(const ff_msgs::GraphVIOState::ConstPtr& graph_vio_state_msg);
56 
57  boost::optional<ff_msgs::EkfState> PublishLatestExtrapolatedLocalizationState();
58 
59  void PublishPoseAndTwistAndTransform(const ff_msgs::EkfState& loc_msg);
60 
61  void Run();
62 
63  void PublishHeartbeat();
64 
65  ros_pose_extrapolator::RosPoseExtrapolatorWrapper ros_pose_extrapolator_wrapper_;
66  std::string platform_name_;
67  ros::NodeHandle imu_nh_, loc_nh_, vio_nh_;
68  ros::CallbackQueue imu_queue_, loc_queue_, vio_queue_;
69  ros::Subscriber imu_sub_, flight_mode_sub_, loc_sub_, vio_sub_;
70  ros::Publisher state_pub_, pose_pub_, twist_pub_, heartbeat_pub_;
71  ff_msgs::Heartbeat heartbeat_;
72  tf2_ros::TransformBroadcaster transform_pub_;
73  ros::Time last_time_;
74  ros::Time last_heartbeat_time_;
75  boost::optional<ros::Time> last_state_msg_time_;
76 };
77 } // namespace ros_pose_extrapolator
78 
79 #endif // ROS_POSE_EXTRAPOLATOR_ROS_POSE_EXTRAPOLATOR_NODELET_H_
mode
uint8_t mode
Definition: signal_lights.h:74
ros_pose_extrapolator::RosPoseExtrapolatorNodelet::RosPoseExtrapolatorNodelet
RosPoseExtrapolatorNodelet()
Definition: ros_pose_extrapolator_nodelet.cc:30
ros_pose_extrapolator
Definition: parameter_reader.h:26
ff_nodelet.h
ros_pose_extrapolator_wrapper.h
ff_util::FreeFlyerNodelet
Definition: ff_nodelet.h:57
ros_pose_extrapolator::RosPoseExtrapolatorNodelet
Definition: ros_pose_extrapolator_nodelet.h:40
ros_pose_extrapolator::RosPoseExtrapolatorWrapper
Definition: ros_pose_extrapolator_wrapper.h:43
localization_common::Time
double Time
Definition: time.h:23