13 #include <std_msgs/UInt32MultiArray.h> 14 #include <std_msgs/Float32MultiArray.h> 15 #include <std_msgs/Float64MultiArray.h> 42 template<
typename MultiArrayMessageType_>
47 ROS_ERROR(
"isRowMajor() failed because layout label is not set correctly.");
57 template<
typename MultiArrayMessageType_>
58 unsigned int getCols(
const MultiArrayMessageType_& message)
60 if (
isRowMajor(message))
return message.layout.dim.at(1).size;
61 return message.layout.dim.at(0).size;
70 template<
typename MultiArrayMessageType_>
71 unsigned int getRows(
const MultiArrayMessageType_& message)
73 if (
isRowMajor(message))
return message.layout.dim.at(0).size;
74 return message.layout.dim.at(1).size;
87 template<
typename EigenType_,
typename MultiArrayMessageType_>
91 m.layout.dim[0].stride = e.size();
92 m.layout.dim[0].size = e.outerSize();
93 m.layout.dim[1].stride = e.innerSize();
94 m.layout.dim[1].size = e.innerSize();
104 m.data.insert(m.data.begin() + m.layout.data_offset, e.data(), e.data() + e.size());
116 template<
typename EigenType_,
typename MultiArrayMessageType_>
120 ROS_ERROR(
"multiArrayMessageToMatrixEigen() failed because the storage order is not compatible.");
125 tempE = Eigen::Map<const EigenType_>(m.data.data(),
getRows(m),
getCols(m));
137 template<
typename EigenType_,
typename MultiArrayMessageType_>
141 ROS_ERROR(
"multiArrayMessageToMatrixEigen() failed because the storage order is not compatible.");
146 e = Eigen::Map<EigenType_>(m.data.data(),
getRows(m),
getCols(m));
bool multiArrayMessageMapToMatrixEigen(MultiArrayMessageType_ &m, EigenType_ &e)
unsigned int getRows(const MultiArrayMessageType_ &message)
bool multiArrayMessageCopyToMatrixEigen(const MultiArrayMessageType_ &m, EigenType_ &e)
bool matrixEigenCopyToMultiArrayMessage(const EigenType_ &e, MultiArrayMessageType_ &m)
std::map< StorageIndices, std::string > storageIndexNames
Holds the names of the storage indeces.
unsigned int getCols(const MultiArrayMessageType_ &message)
bool isRowMajor(const MultiArrayMessageType_ &message)