14 #include <std_msgs/String.h> 53 std_msgs::StringPtr acv_msg(
new std_msgs::String);
71 NODELET_WARN(
"CmdVelMux : %s dislodged due to general timeout",
79 std_msgs::StringPtr acv_msg(
new std_msgs::String);
80 acv_msg->data =
"idle";
102 std_msgs::StringPtr active_msg(
new std_msgs::String);
103 active_msg->data =
"idle";
114 std::unique_ptr<std::istream> is;
118 if (config.yaml_cfg_data.size() > 0)
120 is.reset(
new std::istringstream(config.yaml_cfg_data));
124 std::string yaml_cfg_file;
125 if (config.yaml_cfg_file ==
"")
128 pnh.
getParam(
"yaml_cfg_file", yaml_cfg_file);
132 yaml_cfg_file = config.yaml_cfg_file;
135 is.reset(
new std::ifstream(yaml_cfg_file.c_str(), std::ifstream::in));
136 if (is->good() ==
false)
149 #ifdef HAVE_NEW_YAMLCPP 150 doc = YAML::Load(*is);
152 YAML::Parser parser(*is);
153 parser.GetNextDocument(doc);
159 std::string output_name(
"output");
160 #ifdef HAVE_NEW_YAMLCPP 161 if (doc[
"publisher"])
163 doc[
"publisher"] >> output_name;
166 const YAML::Node *node = doc.FindValue(
"publisher");
169 *node >> output_name;
181 NODELET_DEBUG_STREAM(
"CmdVelMux : no need to re-subscribe to output topic '" << output_name <<
"'");
201 double longest_timeout = 0.0;
208 NODELET_DEBUG(
"CmdVelMux : subscribed to '%s' on topic '%s'. pr: %d, to: %.2f",
#define NODELET_INFO_STREAM(...)
ros::Publisher active_subscriber
dynamic_reconfigure::Server< yocs_cmd_vel_mux::reloadConfig >::CallbackType dynamic_reconfigure_cb
dynamic_reconfigure::Server< yocs_cmd_vel_mux::reloadConfig > * dynamic_reconfigure_server
void configure(const YAML::Node &node)
Configures the subscribers from a yaml file.
CmdVelSubscribers cmd_vel_subs
#define NODELET_WARN(...)
void publish(const boost::shared_ptr< M > &message) const
static const unsigned int VACANT
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
Structure for the yocs_cmd_vel_mux.
void setPeriod(const Duration &period, bool reset=true)
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr &msg, unsigned int idx)
#define NODELET_WARN_STREAM(...)
std::string output_topic_name
ros::NodeHandle & getPrivateNodeHandle() const
#define NODELET_ERROR_STREAM(...)
std::vector< std::shared_ptr< CmdVelSubs > >::size_type size()
double common_timer_period
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define NODELET_DEBUG_STREAM(...)
PLUGINLIB_EXPORT_CLASS(yocs_cmd_vel_mux::CmdVelMuxNodelet, nodelet::Nodelet)
bool getParam(const std::string &key, std::string &s) const
void reloadConfiguration(yocs_cmd_vel_mux::reloadConfig &config, uint32_t unused_level)
static const unsigned int GLOBAL_TIMER
ros::Publisher output_topic_pub
#define NODELET_DEBUG(...)
void timerCallback(const ros::TimerEvent &event, unsigned int idx)