MathExpressionFilter.cpp
Go to the documentation of this file.
1 /*
2  * MathExpressionFilter.cpp
3  *
4  * Created on: Aug 16, 2017
5  * Author: Peter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
10 
13 
14 using namespace filters;
15 
16 namespace grid_map {
17 
18 template<typename T>
20 {
21 }
22 
23 template<typename T>
25 {
26 }
27 
28 template<typename T>
30 {
31  if (!FilterBase<T>::getParam(std::string("expression"), expression_)) {
32  ROS_ERROR("MathExpressionFilter did not find parameter 'expression'.");
33  return false;
34  }
35 
36  if (!FilterBase<T>::getParam(std::string("output_layer"), outputLayer_)) {
37  ROS_ERROR("MathExpressionFilter did not find parameter 'output_layer'.");
38  return false;
39  }
40 
41  // TODO Can we make caching work with changing shared variable?
42 // parser_.setCacheExpressions(true);
43  return true;
44 }
45 
46 template<typename T>
47 bool MathExpressionFilter<T>::update(const T& mapIn, T& mapOut)
48 {
49  mapOut = mapIn;
50  for (const auto& layer : mapOut.getLayers()) {
51  parser_.var(layer).setShared(mapOut[layer]);
52  }
53  EigenLab::Value<Eigen::MatrixXf> result(parser_.eval(expression_));
54  mapOut.add(outputLayer_, result.matrix());
55  return true;
56 }
57 
58 } /* namespace */
59 
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
#define ROS_ERROR(...)


grid_map_filters
Author(s): Péter Fankhauser , Martin Wermelinger
autogenerated on Tue Jun 1 2021 02:13:38