NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ros_command.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 DDS_ROS_BRIDGE_ROS_COMMAND_H_
20 #define DDS_ROS_BRIDGE_ROS_COMMAND_H_
21 
22 #include <cstring>
23 #include <string>
24 #include <memory>
25 
26 #include "dds_ros_bridge/ros_sub_rapid_pub.h"
27 #include "dds_ros_bridge/util.h"
28 
29 #include "ff_msgs/CommandArg.h"
30 #include "ff_msgs/CommandConstants.h"
31 #include "ff_msgs/CommandStamped.h"
32 
33 #include "knDds/DdsTypedSupplier.h"
34 
35 #include "rapidUtil/RapidHelper.h"
36 
37 #include "CommandSupport.h"
38 #include "RapidConstants.h"
39 
40 namespace ff {
41 
43  public:
44  RosCommandToRapid(const std::string& subscribe_topic,
45  const std::string& ac_cmd_sub_topic,
46  const std::string& fail_cmd_sub_topic,
47  const std::string& pub_topic,
48  const ros::NodeHandle &nh,
49  const std::string& agent_name_,
50  const unsigned int queue_size = 10);
51 
52  void ACCmdCallback(ff_msgs::CommandStampedConstPtr const& cmd);
53  void CmdCallback(ff_msgs::CommandStampedConstPtr const& cmd);
54  void EchoCmd(ff_msgs::CommandStampedConstPtr const& cmd);
55  void FailedCmdCallback(ff_msgs::CommandStampedConstPtr const& cmd);
56  private:
57  using CommandSupplier = kn::DdsTypedSupplier<rapid::Command>;
58  using CommandSupplierPtr = std::unique_ptr<CommandSupplier>;
59 
60  CommandSupplierPtr command_supplier_;
61 
62  ros::Subscriber ac_cmd_sub_, failed_cmd_sub_;
63  std::string ac_subscribe_topic_, failed_cmd_subscribe_topic_;
64  std::string agent_name_;
65 };
66 
67 } // end namespace ff
68 
69 #endif // DDS_ROS_BRIDGE_ROS_COMMAND_H_
ff::RosCommandToRapid::ACCmdCallback
void ACCmdCallback(ff_msgs::CommandStampedConstPtr const &cmd)
Definition: ros_command.cc:57
ff::RosCommandToRapid::RosCommandToRapid
RosCommandToRapid(const std::string &subscribe_topic, const std::string &ac_cmd_sub_topic, const std::string &fail_cmd_sub_topic, const std::string &pub_topic, const ros::NodeHandle &nh, const std::string &agent_name_, const unsigned int queue_size=10)
Definition: ros_command.cc:21
ff::RosCommandToRapid::CmdCallback
void CmdCallback(ff_msgs::CommandStampedConstPtr const &cmd)
Definition: ros_command.cc:67
ff::RosSubRapidPub
Definition: ros_sub_rapid_pub.h:30
ff::RosCommandToRapid
Definition: ros_command.h:42
ff
Definition: generic_rapid_msg_ros_pub.h:36
ff::RosCommandToRapid::EchoCmd
void EchoCmd(ff_msgs::CommandStampedConstPtr const &cmd)
Definition: ros_command.cc:72
ff::RosCommandToRapid::FailedCmdCallback
void FailedCmdCallback(ff_msgs::CommandStampedConstPtr const &cmd)
Definition: ros_command.cc:148