45 bool isWithinRange(
const std::vector<double> & lhs,
const std::vector<double> & rhs,
double full_range)
49 if (lhs.size() != rhs.size())
51 ROS_ERROR_STREAM(__FUNCTION__ <<
"::lhs size: " << lhs.size() <<
" does not match rhs size: " << rhs.size());
57 double half_range = full_range / 2.0;
61 for (
size_t i = 0; i < lhs.size(); ++i)
63 if (fabs(lhs[i] - rhs[i]) > fabs(half_range))
75 bool mapInsert(
const std::string & key,
double value, std::map<std::string, double> & mappings)
79 std::pair<std::map<std::string, double>::iterator,
bool> insert_rtn;
81 insert_rtn = mappings.insert(std::make_pair(key, value));
84 if (!insert_rtn.second)
86 ROS_ERROR_STREAM(__FUNCTION__ <<
"::Failed to insert item into map with key: " << key);
97 bool toMap(
const std::vector<std::string> & keys,
const std::vector<double> & values,
98 std::map<std::string, double> & mappings)
104 if (keys.size() ==
values.size())
108 for (
size_t i = 0; i < keys.size(); ++i)
121 <<
" does not match values size: " <<
values.size());
129 bool isWithinRange(
const std::vector<std::string> & keys,
const std::map<std::string, double> & lhs,
130 const std::map<std::string, double> & rhs,
double full_range)
134 if ((keys.size() != rhs.size()) || (keys.size() != lhs.size()))
136 ROS_ERROR_STREAM(__FUNCTION__ <<
"::Size mistmatch ::lhs size: " << lhs.size() <<
137 " rhs size: " << rhs.size() <<
" key size: " << keys.size());
144 double half_range = full_range / 2.0;
148 for (
size_t i = 0; i < keys.size(); ++i)
150 if (fabs(lhs.at(keys[i]) - rhs.at(keys[i])) > fabs(half_range))
162 bool isWithinRange(
const std::vector<std::string> & lhs_keys,
const std::vector<double> & lhs_values,
163 const std::vector<std::string> & rhs_keys,
const std::vector<double> & rhs_values,
double full_range)
166 std::map<std::string, double> lhs_map;
167 std::map<std::string, double> rhs_map;
170 if (
toMap(lhs_keys, lhs_values, lhs_map) &&
toMap(rhs_keys, rhs_values, rhs_map))