7 #include <boost/ref.hpp> 8 #include <boost/accumulators/accumulators.hpp> 9 #include <boost/accumulators/statistics.hpp> 10 #include <boost/spirit/include/phoenix_core.hpp> 11 #include <boost/spirit/include/phoenix_operator.hpp> 41 std::vector<Landmark>
getLandmarks(
const char* filename);
48 template <
typename T> T
calc_stdDev(
const std::vector<T>& vec)
50 using namespace boost::accumulators;
52 accumulator_set<T, stats<tag::variance> > acc;
53 std::for_each(vec.begin(), vec.end(), boost::bind<void>(boost::ref(acc), _1));
54 return (T)sqrt(extract::variance(acc));
67 std::vector<unsigned int>
order_index(std::vector<T>
const& values,
73 using namespace boost::phoenix;
74 using namespace boost::phoenix::arg_names;
76 std::vector<unsigned int> indices(values.size());
78 std::transform(values.begin(), values.end(), indices.begin(), ref(i)++);
81 std::sort(indices.begin(), indices.end(),
82 ref(values)[arg1] > ref(values)[arg2]);
86 std::sort(indices.begin(), indices.end(),
87 ref(values)[arg1] < ref(values)[arg2]);
103 template <
typename T>
104 bool readParam(ros::NodeHandle& nh,
const std::string name, T& variable)
106 std::ostringstream oss;
107 if (nh.getParam(name, variable))
109 oss <<
"Received parameter " << name <<
"=" << variable;
110 ROS_INFO(
"%s", oss.str().c_str());
114 ROS_ERROR(
"Failed to receive parameter %s", name.c_str());
130 template <
typename T>
131 bool readParam(ros::NodeHandle& nh,
const std::string name,
132 std::vector<T>& variable)
134 std::ostringstream oss;
135 if (nh.getParam(name, variable))
137 oss <<
"Received parameter " << name <<
"=[ ";
138 for (
typename std::vector<T>::iterator it = variable.begin();
139 it != variable.end(); ++it)
141 if (
typeid(T) ==
typeid(bool))
142 oss << std::boolalpha << *it <<
" ";
148 ROS_INFO(
"%s", oss.str().c_str());
152 ROS_ERROR(
"Failed to receive parameter %s", name.c_str());
168 rosPrev = rosNew = ros::Time::now();
169 wallPrev = wallNew = ros::WallTime::now();
183 diff = (rosNew-rosPrev).toNSec() * 1e-9;
193 diff = (wallNew-wallPrev).toNSec() * 1e-9;
203 #endif // PFUCLT_AUX_H bool readParam(ros::NodeHandle &nh, const std::string name, T &variable)
readParam - reads and returns a parameter from the ROS parameter server
double updateTime(ros::WallTime t)
std::vector< unsigned int > order_index(std::vector< T > const &values, const ORDER_TYPE order=DESC)
order_index - Generates a vector of indexes ordered according to another vector
T calc_stdDev(const std::vector< T > &vec)
calc_stdDev - Calculates standard deviation from a vector of type T
ORDER_TYPE
The ORDER_TYPE enum - use to define an ascending or descending ordering.
struct pfuclt_omni_dataset::landmark_s Landmark
The Landmark struct - used to store a landmark, defined by its serial number, and its position {x...
std::vector< Landmark > getLandmarks(const char *filename)
getLandmarks - read landmark configuration from CSV file
The timeEval_s struct - takes care of time difference evaluation through the ros::Time methods...
struct pfuclt_omni_dataset::timeEval_s TimeEval
The timeEval_s struct - takes care of time difference evaluation through the ros::Time methods...
double updateTime(ros::Time t)
updateTime - adds the newest time available to the struct and returns the time difference ...
The Landmark struct - used to store a landmark, defined by its serial number, and its position {x...