casadi-utils.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 Inria
3 //
4 // Utils for tests, e.g. conversion between Eigen matrix
5 // and DM without copy.
8 
10 template<typename Derived>
11 casadi::DM eigenToDM(const Eigen::MatrixBase<Derived> & x)
12 {
13  typedef Eigen::Map<Derived> Map_t;
14  std::vector<double> x_vec((size_t)x.size());
15  Map_t(x_vec.data(), x.rows(), x.cols()) = x;
16  casadi::DM out(x_vec);
17  return reshape(out, x.rows(), x.cols());
18 }
19 
20 template<typename Derived>
22 {
24  typedef typename Derived::Scalar Scalar;
25  typename SE3::HomogeneousMatrixType M_mat = M.toHomogeneousMatrix();
26  std::vector<Scalar> flat_M_vec(M_mat.data(), M_mat.data() + M_mat.size());
27  casadi::DM out{flat_M_vec};
28  return reshape(out, 4, 4);
29 }
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
casadi-algo.hpp
x
x
M
M
pinocchio::SE3Base
Base class for rigid transformation.
Definition: se3-base.hpp:30
casadi.hpp
pinocchio::python::context::SE3
SE3Tpl< Scalar, Options > SE3
Definition: bindings/python/context/generic.hpp:53
SE3toCasadiDM
casadi::DM SE3toCasadiDM(const pinocchio::SE3Base< Derived > &M)
Definition: casadi-utils.hpp:21
eigenToDM
casadi::DM eigenToDM(const Eigen::MatrixBase< Derived > &x)
Without copy.
Definition: casadi-utils.hpp:11


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:39