EigenConverter.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5 * Karlsruhe Institute of Technology (KIT), all rights reserved.
6 *
7 * ArmarX is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
20 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23
24// STD/STL
25
26
27// Header
28#include "EigenConverter.h"
29
31{
32 Eigen::Quaternion<float>
37
38 Eigen::Quaternion<double>
43
44 Eigen::Vector3f
49
50 Eigen::Vector3d
55
56 Eigen::Matrix4f
61
62 Eigen::Matrix4d
67
68 Eigen::Quaternion<float>
73
74 Eigen::Quaternion<double>
79
80 Eigen::Vector3f
85
86 Eigen::Vector3d
91
92 Eigen::Matrix4f
97
98 Eigen::Matrix4d
103
104 void
105 AronEigenConverter::checkDimensions(const data::NDArray& nav,
106 const std::vector<int>& expected,
107 const std::string& method,
108 const std::string& caller)
109 {
110 if (nav.getShape() != expected)
111 {
112 std::stringstream ss;
113 ss << "The size of an NDArray does not match.";
114 ss << "\n Expected: \t" << data::NDArray::DimensionsToString(expected);
115 ss << "\n Got: \t" << data::NDArray::DimensionsToString(nav.getShape());
116 ss << "\n";
117 throw error::AronException(__PRETTY_FUNCTION__, ss.str(), nav.getPath());
118 }
119 }
120} // namespace armarx::aron::data::converter
static std::string DimensionsToString(const std::vector< int > &dimensions)
Return dimensions in a readable string such as "(2, 3, 4)".
Definition NDArray.cpp:257
static Eigen::Quaternion< double > ConvertToQuaterniond(const data::NDArrayPtr &)
static Eigen::Matrix< T, Rows, Cols > ConvertToMatrix(const data::NDArrayPtr &nav)
static Eigen::Matrix< T, Size, 1 > ConvertToVector(const data::NDArrayPtr &nav)
static Eigen::Matrix4f ConvertToMatrix4f(const data::NDArrayPtr &)
static Eigen::Vector3f ConvertToVector3f(const data::NDArrayPtr &)
static Eigen::Quaternion< T > ConvertToQuaternion(const data::NDArrayPtr &nav)
static Eigen::Vector3d ConvertToVector3d(const data::NDArrayPtr &)
static Eigen::Matrix4d ConvertToMatrix4d(const data::NDArrayPtr &)
static Eigen::Quaternion< float > ConvertToQuaternionf(const data::NDArrayPtr &)
A base class for aron exceptions.
Definition Exception.h:37
std::shared_ptr< NDArray > NDArrayPtr
Definition NDArray.h:46