NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
generic_rapid_sub.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 #ifndef COMMS_BRIDGE_GENERIC_RAPID_SUB_H_
20 #define COMMS_BRIDGE_GENERIC_RAPID_SUB_H_
21 
22 #include <memory>
23 #include <string>
24 #include <thread>
25 #include <atomic>
26 
27 #include "ros/ros.h"
28 
29 #include "knDds/DdsEventLoop.h"
30 
31 #include "knShare/Time.h"
32 
33 namespace ff {
34 
43  protected:
44  GenericRapidSub(const std::string& entity_name,
45  const std::string& subscribe_topic,
46  const std::string& subscriber_partition);
47 
49 
53  virtual void StartThread();
54 
55  std::string subscribe_topic_;
56  std::string subscriber_partition_;
57 
58  std::atomic<bool> alive_;
59  std::thread thread_;
60  kn::DdsEventLoop dds_event_loop_;
61 
62  private:
67  virtual void ThreadExec();
68 };
69 
70 typedef std::shared_ptr<GenericRapidSub> GenericRapidSubPtr;
71 
72 } // end namespace ff
73 
74 #endif // COMMS_BRIDGE_GENERIC_RAPID_SUB_H_
ff::GenericRapidSubPtr
std::shared_ptr< GenericRapidSub > GenericRapidSubPtr
Definition: generic_rapid_sub.h:70
ff::GenericRapidSub::alive_
std::atomic< bool > alive_
Definition: generic_rapid_sub.h:58
ff::GenericRapidSub::thread_
std::thread thread_
Definition: generic_rapid_sub.h:59
ff::GenericRapidSub
base class for rapid subscriber to ros publisher
Definition: generic_rapid_sub.h:42
ff::GenericRapidSub::StartThread
virtual void StartThread()
Definition: generic_rapid_sub.cpp:37
ff
Definition: generic_rapid_msg_ros_pub.h:36
ff::GenericRapidSub::GenericRapidSub
GenericRapidSub(const std::string &entity_name, const std::string &subscribe_topic, const std::string &subscriber_partition)
Definition: generic_rapid_sub.cpp:25
ff::GenericRapidSub::subscriber_partition_
std::string subscriber_partition_
Definition: generic_rapid_sub.h:56
ff::GenericRapidSub::dds_event_loop_
kn::DdsEventLoop dds_event_loop_
Definition: generic_rapid_sub.h:60
ff::GenericRapidSub::~GenericRapidSub
~GenericRapidSub()
Definition: generic_rapid_sub.cpp:32
ff::GenericRapidSub::subscribe_topic_
std::string subscribe_topic_
Definition: generic_rapid_sub.h:55