Go to the documentation of this file.
5 #ifndef __pinocchio_utils_code_generator_base_hpp__
6 #define __pinocchio_utils_code_generator_base_hpp__
16 template<
typename _Scalar>
35 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Options>
MatrixXs;
36 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options>
VectorXs;
37 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Options | Eigen::RowMajor>
39 typedef Eigen::Matrix<ADScalar, Eigen::Dynamic, 1, Options>
ADVectorXs;
40 typedef Eigen::Matrix<ADScalar, Eigen::Dynamic, Eigen::Dynamic, Options>
ADMatrixXs;
48 typedef CppAD::ADFun<CGScalar>
ADFun;
52 const Eigen::DenseIndex dim_input,
53 const Eigen::DenseIndex dim_output,
83 cgen_ptr = std::unique_ptr<CppAD::cg::ModelCSourceGen<Scalar>>(
87 libcgen_ptr = std::unique_ptr<CppAD::cg::ModelLibraryCSourceGen<Scalar>>(
88 new CppAD::cg::ModelLibraryCSourceGen<Scalar>(*
cgen_ptr));
100 const std::string & gcc_path =
"/usr/bin/gcc",
const std::string & compile_options =
"-Ofast")
102 CppAD::cg::GccCompiler<Scalar> compiler(gcc_path);
103 std::vector<std::string> compile_flags = compiler.getCompileFlags();
104 compile_flags[0] = compile_options;
105 compiler.setCompileFlags(compile_flags);
112 + CppAD::cg::system::SystemInfo<>::DYNAMIC_LIB_EXTENSION;
113 std::ifstream file(
filename.c_str());
124 const bool generate_if_not_exist =
true,
125 const std::string & gcc_path =
"/usr/bin/gcc",
126 const std::string & compile_options =
"-Ofast")
128 if (!
existLib() && generate_if_not_exist)
136 + CppAD::cg::system::SystemInfo<>::DYNAMIC_LIB_EXTENSION));
140 int dlOpenMode = std::stoi(
it->second);
143 + CppAD::cg::system::SystemInfo<>::DYNAMIC_LIB_EXTENSION,
150 template<
typename Vector>
158 template<
typename Vector>
163 CppAD::cg::ArrayView<const Scalar> x_(
165 CppAD::cg::ArrayView<Scalar> jac_(
jac.data(), (
size_t)
jac.size());
204 std::unique_ptr<CppAD::cg::ModelCSourceGen<Scalar>>
cgen_ptr;
205 std::unique_ptr<CppAD::cg::ModelLibraryCSourceGen<Scalar>>
libcgen_ptr;
214 #endif // ifndef __pinocchio_utils_code_generator_base_hpp__
std::unique_ptr< CppAD::cg::DynamicModelLibraryProcessor< Scalar > > dynamicLibManager_ptr
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
pinocchio::ModelTpl< CGScalar, Options > CGModel
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
std::string name(const LieGroupGenericTpl< LieGroupCollection > &lg)
Visit a LieGroupVariant to get the name of it.
virtual void buildMap()=0
build the mapping Y = f(X)
bool build_forward
Options to generate or not the source code for the evaluation function.
Eigen::Matrix< ADScalar, Eigen::Dynamic, 1, Options > ADVectorXs
void compileLib(const std::string &gcc_path="/usr/bin/gcc", const std::string &compile_options="-Ofast")
NewScalar cast(const Scalar &value)
CodeGenBase(const Model &model, const Eigen::DenseIndex dim_input, const Eigen::DenseIndex dim_output, const std::string &function_name, const std::string &library_name)
std::unique_ptr< CppAD::cg::ModelLibraryCSourceGen< Scalar > > libcgen_ptr
CppAD::ADFun< CGScalar > ADFun
void loadLib(const bool generate_if_not_exist=true, const std::string &gcc_path="/usr/bin/gcc", const std::string &compile_options="-Ofast")
Model::ConfigVectorType ConfigVectorType
ADConfigVectorType ad_q_plus
VectorXs TangentVectorType
Dense vectorized version of a joint tangent vector (e.g. velocity, acceleration, etc)....
std::unique_ptr< CppAD::cg::GenericModel< Scalar > > generatedFun_ptr
CppAD::AD< CGScalar > ADScalar
pinocchio::DataTpl< Scalar, Options > Data
pinocchio::ModelTpl< ADScalar, Options > ADModel
CppAD::cg::CG< Scalar > CGScalar
const std::string function_name
Name of the function.
ADModel::ConfigVectorType ADConfigVectorType
ADTangentVectorType ad_dq
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options|Eigen::RowMajor > RowMatrixXs
CppAD::cg::ModelCSourceGen< Scalar > & codeGenerator()
bool build_jacobian
Options to build or not the Jacobian of he function.
Model::TangentVectorType TangentVectorType
void compileAndLoadLib(const std::string &gcc_path)
void evalJacobian(const Eigen::MatrixBase< Vector > &x)
std::unique_ptr< CppAD::cg::ModelCSourceGen< Scalar > > cgen_ptr
const std::string library_name
Name of the library.
Eigen::Matrix< ADScalar, Eigen::Dynamic, Eigen::Dynamic, Options > ADMatrixXs
ADModel::TangentVectorType ADTangentVectorType
Eigen::DenseIndex getOutputDimension() const
Dimension of the output vector.
Eigen::DenseIndex getInputDimension() const
Dimension of the input vector.
void evalFunction(const Eigen::MatrixBase< Vector > &x)
pinocchio::ModelTpl< Scalar, Options > Model
VectorXs ConfigVectorType
Dense vectorized version of a joint configuration vector.
pinocchio::DataTpl< CGScalar, Options > CGData
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
JointCollectionTpl & model
std::unique_ptr< CppAD::cg::DynamicLib< Scalar > > dynamicLib_ptr
pinocchio::DataTpl< ADScalar, Options > ADData
Main pinocchio namespace.
pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:42