SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
wrap_eigen.hpp
Go to the documentation of this file.
1 /*
2  * Stanford Whole-Body Control Framework http://stanford-scl.sourceforge.net/
3  *
4  * Copyright (c) 2010 Stanford University. All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This program 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program. If not, see
18  * <http://www.gnu.org/licenses/>
19  */
20 
27 #ifndef JSPACE_WRAP_EIGEN_HPP
28 #define JSPACE_WRAP_EIGEN_HPP
29 
30 #include <Eigen/Geometry>
31 #include <vector>
32 
33 #ifdef W_QNX
34 extern "C" {
35 #include <stddef.h> // for qnx
36 }
37 #endif
38 
39 //NOTE TODO : This file needs to be deleted. There is no need to have wrappers.
40 
41 namespace jspace
42 {
43  void convert(Eigen::VectorXd const & from, std::vector<double> & to);
44  void convert(std::vector<double> const & from, Eigen::VectorXd & to);
45  void convert(double const * from, size_t length, Eigen::VectorXd & to);
46 
47  // should also work as-is for jspace::Vector
48  bool compare(Eigen::MatrixXd const & lhs, Eigen::MatrixXd const & rhs, double precision);
49  bool compare(Eigen::Quaternion<double> const & lhs, Eigen::Quaternion<double> const & rhs, double precision);
50 
51  std::string pretty_string(double vv);
52  std::string pretty_string(Eigen::VectorXd const & vv);
53  std::string pretty_string(Eigen::Quaternion<double> const & qq);
54  std::string pretty_string(Eigen::MatrixXd const & mm, std::string const & prefix);
55 
56  void pretty_print(Eigen::VectorXd const & vv, std::ostream & os,
57  std::string const & title, std::string const & prefix, bool nonl = false);
58 
59  inline void pretty_print(Eigen::Vector3d const & vv, std::ostream & os,
60  std::string const & title, std::string const & prefix, bool nonl = false)
61  {
62  pretty_print(static_cast<Eigen::VectorXd const &>(vv), os, title, prefix, nonl);
63  }
64 
65  void pretty_print(Eigen::Quaternion<double> const & qq, std::ostream & os,
66  std::string const & title, std::string const & prefix, bool nonl = false);
67 
68  void pretty_print(Eigen::MatrixXd const & mm, std::ostream & os,
69  std::string const & title, std::string const & prefix,
70  bool vecmode = false, bool nonl = false);
71 
72 }
73 
74 #endif // JSPACE_WRAP_EIGEN_HPP