ISAAC  0.2.11
Flight software for the ISAAC project, adding functionality to the Astrobee robot, operating inside the International Space Station.
All Classes Functions Variables Pages
ros_gs_bridge.h
1 /* Copyright (c) 2021, United States Government, as represented by the"
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The "ISAAC - Integrated System for Autonomous and Adaptive Caretaking
7  * platform" software is licensed under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with the
9  * License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16  * License for the specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef ROS_GS_BRIDGE_ROS_GS_BRIDGE_H_
21 #define ROS_GS_BRIDGE_ROS_GS_BRIDGE_H_
22 
23 // Standard ROS includes
24 #include <ros/ros.h>
25 
26 // Shared project includes
27 #include <ff_util/ff_action.h>
28 #include <ff_common/ff_names.h>
29 #include <isaac_util/isaac_names.h>
30 
31 // Messages
32 #include <ff_msgs/AccessControlStateStamped.h>
33 #include <ff_msgs/CommandConstants.h>
34 #include <ff_msgs/CommandStamped.h>
35 #include <ff_msgs/GuestScienceData.h>
36 #include <isaac_hw_msgs/WifiSignals.h>
37 
38 // Actions
39 #include <isaac_msgs/ImageInspectionAction.h>
40 #include <isaac_msgs/InspectionAction.h>
41 
42 // Services
43 #include <std_srvs/Empty.h>
44 
45 // C++ headers
46 #include <string>
47 #include <queue>
48 
49 namespace ros_gs_bridge {
50 
52  public:
53  RosGsBridge();
54  ~RosGsBridge();
55 
56  bool Initialize(ros::NodeHandle *nh);
57 
58  // Message Callbacks
59  void AccessControlStateCallback(ff_msgs::AccessControlStateStampedConstPtr
60  const& state);
61  void GuestScienceDataCallback(ff_msgs::GuestScienceDataConstPtr const& data);
62 
63 
64  // Service Callbacks
65  bool GrabControlService(std_srvs::Empty::Request& req,
66  std_srvs::Empty::Response& res);
67 
68  // Action Callbacks
69  // TODO(Katie) Add image inspection feedback for completeness
70  void ImageInspectionResultCallback(
71  ff_util::FreeFlyerActionState::Enum const& state,
72  isaac_msgs::ImageInspectionResultConstPtr const& result);
73 
74  void InspectionGoalCallback(isaac_msgs::InspectionGoalConstPtr const& goal);
75  void InspectionPreemptCallback();
76  void InspectionCancelCallback();
77 
78  void FillTimeIdInGSCmd();
79  void GrabControl(std::string cookie);
80  bool HasControl();
81  void RequestControl();
82  void SendNextGSCommand();
83 
84  private:
85  bool requesting_control_, grabbing_control_, send_command_;
86 
87  ff_util::FreeFlyerActionClient<isaac_msgs::ImageInspectionAction> img_ac_;
88  ff_util::FreeFlyerActionServer<isaac_msgs::InspectionAction> inspection_as_;
89 
90  int pub_queue_size_, sub_queue_size_, cmd_counter_;
91 
92  ros::NodeHandle* nh_;
93  ros::Publisher cmd_pub_, wifi_signals_pub_;
94  ros::ServiceServer grab_control_srv_;
95  ros::Subscriber sub_access_control_state_, sub_gs_data_;
96 
97  // TODO(Katie): Make a queue of a new class you create. Class will need to
98  // keep track of the custom guest science command associated with one type
99  // of goal, feedback, result, or topic
100  ff_msgs::CommandStamped custom_gs_command_;
101  std::string controller_, isaac_apk_name_, isaac_controller_name_;
102 };
103 
104 } // namespace ros_gs_bridge
105 
106 #endif // ROS_GS_BRIDGE_ROS_GS_BRIDGE_H_
ros_gs_bridge::RosGsBridge
Definition: ros_gs_bridge.h:51