9 const std::string param_name,
12 std::vector<double> vals;
16 if (n.
hasParam((param_name + std::string(
"/data").c_str())))
18 n.
getParam((param_name + std::string(
"/data")).c_str(), vals);
20 if (n.
hasParam((param_name + std::string(
"/rows").c_str())) &&
21 n.
hasParam((param_name + std::string(
"/cols").c_str())))
23 n.
getParam((param_name + std::string(
"/rows")).c_str(), rows);
24 n.
getParam((param_name + std::string(
"/cols")).c_str(), cols);
32 <<
". You can set dimensions by setting the parameter " 40 << param_name <<
" has no data values (" << param_name
41 <<
"/data)! Shutting down...");
48 <<
" does not exist");
56 const std::vector<double> &vals)
58 double size_f, frac_part, discard;
61 size_f = std::sqrt(vals.size());
62 frac_part = std::modf(size_f, &discard);
67 std::stringstream errMsg;
68 errMsg <<
"MatrixParser: Tried to initialize a square matrix with a " 70 << vals.size() <<
") number of values";
71 throw std::logic_error(errMsg.str().c_str());
74 ROS_DEBUG(
"MatrixParser: filling matrix");
79 const std::vector<double> &vals,
82 if (rows <= 0 || cols <= 0)
84 std::stringstream errMsg;
85 errMsg <<
"MatrixParser: Tried to initialize a matrix with dims " << rows
87 throw std::logic_error(errMsg.str().c_str());
90 ROS_DEBUG(
"MatrixParser: filling matrix");
92 M = Eigen::MatrixXd(rows, cols);
95 for (
unsigned int i = 0; i < rows; i++)
97 for (
unsigned int j = 0; j < cols; j++)
99 M(i, j) = vals[idx++];
108 S << 0, -v(2), v(1), v(2), 0, -v(0), -v(1), v(0), 0;
bool getParam(const std::string &key, std::string &s) const
#define ROS_WARN_STREAM(args)
bool hasParam(const std::string &key) const
#define ROS_ERROR_STREAM(args)