NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ros_bridge.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 TRAJ_OPT_ROS_ROS_BRIDGE_H_
20 #define TRAJ_OPT_ROS_ROS_BRIDGE_H_
21 
22 #include <ros/ros.h>
24 #include <traj_opt_msgs/Polynomial.h>
25 #include <traj_opt_msgs/Spline.h>
26 #include <traj_opt_msgs/Trajectory.h>
27 #include <traj_opt_msgs/SolverInfo.h>
28 #include <string>
29 #include <map>
30 
32  public:
33  // No need to instantiate pesky variables!
36  static traj_opt_msgs::SolverInfo convert(const traj_opt::SolverInfo &data);
37 
38  // make sure to run ros::init() before calling these functions or they won't work
39  static void publish_msg(const traj_opt_msgs::Trajectory &msg,
40  std::string frame_id = "map",
41  std::string topic = "trajectory");
42  static void publish_msg(const traj_opt::TrajData &data,
43  std::string frame_id = "map",
44  std::string topic = "trajectory");
45  static void publish_msg(const traj_opt::SolverInfo &data,
46  std::string topic = "solver_info");
47  static void publish_msg(const traj_opt_msgs::SolverInfo &msg,
48  std::string topic = "solver_info");
49 
50  static bool are_subscribers(std::string topic);
51 
52  // Use global singleton paradignm. All these things are private!
53  // Keep your government out of my contructors!
54  private:
55  TrajRosBridge();
56  static TrajRosBridge &instance();
57  static ros::Publisher getPub(std::string topic);
58  static ros::Publisher getInfoPub(std::string topic);
59  ros::NodeHandle nh_;
60  std::map<std::string, ros::Publisher> pubs_;
61 };
62 
63 #endif // TRAJ_OPT_ROS_ROS_BRIDGE_H_
TrajRosBridge::convert
static traj_opt_msgs::Trajectory convert(const traj_opt::TrajData &data)
Definition: ros_bridge.cpp:59
traj_data.h
traj_opt::TrajData
Definition: traj_data.h:61
TrajRosBridge::publish_msg
static void publish_msg(const traj_opt_msgs::Trajectory &msg, std::string frame_id="map", std::string topic="trajectory")
Definition: ros_bridge.cpp:47
TrajRosBridge::are_subscribers
static bool are_subscribers(std::string topic)
Definition: ros_bridge.cpp:42
traj_opt::SolverInfo
Definition: traj_data.h:74
vive_localization::Trajectory
std::map< ros::Time, double[6]> Trajectory
Definition: vive_solver.h:119
TrajRosBridge
Definition: ros_bridge.h:31