NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
generic_rapid_pub.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_PUB_H_
20 #define COMMS_BRIDGE_GENERIC_RAPID_PUB_H_
21 
22 #include <comms_bridge/util.h>
23 #include <ros/ros.h>
24 
25 #include <string>
26 
27 #include "knDds/DdsTypedSupplier.h"
28 
29 #include "rapidUtil/RapidHelper.h"
30 
31 #include "dds_msgs/AstrobeeConstantsSupport.h"
32 #include "dds_msgs/GenericCommsAdvertisementInfoSupport.h"
33 #include "dds_msgs/GenericCommsContentSupport.h"
34 
35 namespace ff {
36 
38  public:
39  explicit GenericRapidPub(std::string const& robot_name);
41 
42  template <typename T>
43  void CopyString(const int max_size,
44  std::string src,
45  T &dest,
46  std::string const& data_name,
47  std::string const& topic);
48 
49  void SendAdvertisementInfo(std::string const& output_topic,
50  bool latching,
51  std::string const& data_type,
52  std::string const& md5_sum,
53  std::string definition);
54 
55  void SendContent(std::string const& output_topic,
56  std::string const& md5_sum,
57  uint8_t const* data,
58  const size_t data_size,
59  const int seq_num);
60 
61  private:
62  using AdvertisementInfoSupplier =
63  kn::DdsTypedSupplier<rapid::ext::astrobee::GenericCommsAdvertisementInfo>;
64  using AdvertisementInfoSupplierPtr =
65  std::unique_ptr<AdvertisementInfoSupplier>;
66  AdvertisementInfoSupplierPtr advertisement_info_supplier_;
67 
68  using ContentSupplier =
69  kn::DdsTypedSupplier<rapid::ext::astrobee::GenericCommsContent>;
70  using ContentSupplierPtr = std::unique_ptr<ContentSupplier>;
71  ContentSupplierPtr content_supplier_;
72 
73  unsigned int advertisement_info_seq_;
74 };
75 
76 typedef std::shared_ptr<ff::GenericRapidPub> GenericRapidPubPtr;
77 
78 } // end namespace ff
79 
80 #endif // COMMS_BRIDGE_GENERIC_RAPID_PUB_H_
ff::GenericRapidPubPtr
std::shared_ptr< ff::GenericRapidPub > GenericRapidPubPtr
Definition: generic_rapid_pub.h:76
ff::GenericRapidPub::~GenericRapidPub
~GenericRapidPub()
Definition: generic_rapid_pub.cpp:47
ff::GenericRapidPub::SendAdvertisementInfo
void SendAdvertisementInfo(std::string const &output_topic, bool latching, std::string const &data_type, std::string const &md5_sum, std::string definition)
Definition: generic_rapid_pub.cpp:66
ff::GenericRapidPub
Definition: generic_rapid_pub.h:37
ff
Definition: generic_rapid_msg_ros_pub.h:36
ff::GenericRapidPub::CopyString
void CopyString(const int max_size, std::string src, T &dest, std::string const &data_name, std::string const &topic)
Definition: generic_rapid_pub.cpp:50
ff::GenericRapidPub::SendContent
void SendContent(std::string const &output_topic, std::string const &md5_sum, uint8_t const *data, const size_t data_size, const int seq_num)
Definition: generic_rapid_pub.cpp:122
util.h
ff::GenericRapidPub::GenericRapidPub
GenericRapidPub(std::string const &robot_name)
Definition: generic_rapid_pub.cpp:25