NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ros_guest_science.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 
19 
20 #ifndef DDS_ROS_BRIDGE_ROS_GUEST_SCIENCE_H_
21 #define DDS_ROS_BRIDGE_ROS_GUEST_SCIENCE_H_
22 
23 #include <string>
24 #include <cstring>
25 #include <memory>
26 
27 #include "dds_ros_bridge/ros_sub_rapid_pub.h"
28 #include "dds_ros_bridge/util.h"
29 
30 #include "ff_msgs/GuestScienceApk.h"
31 #include "ff_msgs/GuestScienceCommand.h"
32 #include "ff_msgs/GuestScienceConfig.h"
33 #include "ff_msgs/GuestScienceData.h"
34 #include "ff_msgs/GuestScienceState.h"
35 
36 #include "knDds/DdsTypedSupplier.h"
37 
38 #include "rapidUtil/RapidHelper.h"
39 
40 #include "dds_msgs/AstrobeeConstants.h"
41 #include "dds_msgs/GuestScienceConfigSupport.h"
42 #include "dds_msgs/GuestScienceDataSupport.h"
43 #include "dds_msgs/GuestScienceStateSupport.h"
44 
45 namespace ff {
46 
48  public:
49  RosGuestScienceToRapid(const std::string& state_subscribe_topic,
50  const std::string& config_subscribe_topic,
51  const std::string& data_subscribe_topic,
52  const std::string& pub_topic,
53  const ros::NodeHandle &nh,
54  const unsigned int queue_size = 10);
55 
56  void DataCallback(ff_msgs::GuestScienceDataConstPtr const& data);
57  void ConfigCallback(ff_msgs::GuestScienceConfigConstPtr const& config);
58  void StateCallback(ff_msgs::GuestScienceStateConstPtr const& state);
59 
60  private:
61  using StateSupplier =
62  kn::DdsTypedSupplier<rapid::ext::astrobee::GuestScienceState>;
63  using StateSupplierPtr = std::unique_ptr<StateSupplier>;
64 
65  StateSupplierPtr state_supplier_;
66 
67  using ConfigSupplier =
68  kn::DdsTypedSupplier<rapid::ext::astrobee::GuestScienceConfig>;
69  using ConfigSupplierPtr = std::unique_ptr<ConfigSupplier>;
70 
71  ConfigSupplierPtr config_supplier_;
72 
73  using DataSupplier =
74  kn::DdsTypedSupplier<rapid::ext::astrobee::GuestScienceData>;
75  using DataSupplierPtr = std::unique_ptr<DataSupplier>;
76 
77  DataSupplierPtr data_supplier_;
78 
79  ros::Subscriber config_sub_, data_sub_;
80 
81  std::string config_subscribe_topic_, data_subscribe_topic_;
82 };
83 
84 } // end namespace ff
85 
86 #endif // DDS_ROS_BRIDGE_ROS_GUEST_SCIENCE_H_
ff::RosGuestScienceToRapid
Definition: ros_guest_science.h:47
ff::RosGuestScienceToRapid::StateCallback
void StateCallback(ff_msgs::GuestScienceStateConstPtr const &state)
Definition: ros_guest_science.cc:203
ff::RosSubRapidPub
Definition: ros_sub_rapid_pub.h:30
ff
Definition: generic_rapid_msg_ros_pub.h:36
ff::RosGuestScienceToRapid::DataCallback
void DataCallback(ff_msgs::GuestScienceDataConstPtr const &data)
Definition: ros_guest_science.cc:159
ff::RosGuestScienceToRapid::ConfigCallback
void ConfigCallback(ff_msgs::GuestScienceConfigConstPtr const &config)
Definition: ros_guest_science.cc:87
ff::RosGuestScienceToRapid::RosGuestScienceToRapid
RosGuestScienceToRapid(const std::string &state_subscribe_topic, const std::string &config_subscribe_topic, const std::string &data_subscribe_topic, const std::string &pub_topic, const ros::NodeHandle &nh, const unsigned int queue_size=10)
Definition: ros_guest_science.cc:44
state
uint8_t state
Definition: signal_lights.h:90