Go to the documentation of this file.00001
00009
00010
00011
00012
00013 #include <fstream>
00014 #include "../include/cmd_vel_mux/cmd_vel_subscribers.hpp"
00015 #include "../include/cmd_vel_mux/exceptions.hpp"
00016
00017
00018
00019
00020
00021 namespace cmd_vel_mux {
00022
00023
00024
00025
00026
00027 void CmdVelSubscribers::CmdVelSubs::operator << (const YAML::Node& node)
00028 {
00029 node["name"] >> name;
00030 node["topic"] >> topic;
00031 node["timeout"] >> timeout;
00032 node["priority"] >> priority;
00033 if (node.FindValue("short_desc") != NULL) {
00034 node["short_desc"] >> short_desc;
00035 }
00036 }
00037
00038 void CmdVelSubscribers::configure(const YAML::Node& node) {
00039
00040 list.clear();
00041 try
00042 {
00043 if ( node.size() == 0 ) {
00044 throw EmptyCfgException();
00045 }
00046
00047 for (unsigned int i = 0; i < node.size(); i++)
00048 {
00049
00050 CmdVelSubs subscriber(i);
00051 subscriber << node[i];
00052 list.push_back(subscriber);
00053 }
00054 }
00055 catch(EmptyCfgException& e) {
00056 throw e;
00057 }
00058 catch(YAML::ParserException& e)
00059 {
00060 throw YamlException(e.what());
00061 }
00062 catch(YAML::RepresentationException& e)
00063 {
00064 throw YamlException(e.what());
00065 }
00066 }
00067
00068
00069 }