NASA Astrobee Robot Software  0.16.7
Flight software for the Astrobee robot operating inside the International Space Station.
imu_augmentor_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 IMU_AUGMENTOR_IMU_AUGMENTOR_NODELET_H_
19 #define IMU_AUGMENTOR_IMU_AUGMENTOR_NODELET_H_
20 
21 #include <ff_msgs/EkfState.h>
22 #include <ff_msgs/FlightMode.h>
23 #include <ff_msgs/GraphState.h>
24 #include <ff_msgs/Heartbeat.h>
25 #include <ff_util/ff_nodelet.h>
27 
28 #include <ros/node_handle.h>
29 #include <ros/publisher.h>
30 #include <ros/subscriber.h>
31 #include <sensor_msgs/Imu.h>
32 #include <tf2_ros/transform_broadcaster.h>
33 
34 #include <boost/optional.hpp>
35 
36 #include <string>
37 
38 namespace imu_augmentor {
40  public:
42 
43  private:
44  void Initialize(ros::NodeHandle* nh) final;
45 
46  void SubscribeAndAdvertise(ros::NodeHandle* nh);
47 
48  void ImuCallback(const sensor_msgs::Imu::ConstPtr& imu_msg);
49 
50  void FlightModeCallback(ff_msgs::FlightMode::ConstPtr const& mode);
51 
52  void LocalizationStateCallback(const ff_msgs::GraphState::ConstPtr& loc_msg);
53 
54  boost::optional<ff_msgs::EkfState> PublishLatestImuAugmentedLocalizationState();
55 
56  void PublishPoseAndTwistAndTransform(const ff_msgs::EkfState& loc_msg);
57 
58  void Run();
59 
60  void PublishHeartbeat();
61 
62  imu_augmentor::ImuAugmentorWrapper imu_augmentor_wrapper_;
63  std::string platform_name_;
64  ros::NodeHandle imu_nh_, loc_nh_;
65  ros::CallbackQueue imu_queue_, loc_queue_;
66  ros::Subscriber imu_sub_, flight_mode_sub_, state_sub_;
67  ros::Publisher state_pub_, pose_pub_, twist_pub_, heartbeat_pub_;
68  ff_msgs::Heartbeat heartbeat_;
69  tf2_ros::TransformBroadcaster transform_pub_;
70  ros::Time last_time_;
71  ros::Time last_heartbeat_time_;
72  boost::optional<ros::Time> last_state_msg_time_;
73 };
74 } // namespace imu_augmentor
75 
76 #endif // IMU_AUGMENTOR_IMU_AUGMENTOR_NODELET_H_
mode
uint8_t mode
Definition: signal_lights.h:74
imu_augmentor::ImuAugmentorWrapper
Definition: imu_augmentor_wrapper.h:38
ff_nodelet.h
imu_augmentor::ImuAugmentorNodelet
Definition: imu_augmentor_nodelet.h:39
ff_util::FreeFlyerNodelet
Definition: ff_nodelet.h:57
imu_augmentor::ImuAugmentorNodelet::ImuAugmentorNodelet
ImuAugmentorNodelet()
Definition: imu_augmentor_nodelet.cc:30
imu_augmentor_wrapper.h
localization_common::Time
double Time
Definition: time.h:23
imu_augmentor
Definition: imu_augmentor.h:28