Unverified Commit f4a92f39 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1060 from proyan/devel

Minor fixes in code-gen benchmark and code-gen
parents 0f221d87 4aa6ff00
......@@ -38,8 +38,7 @@ int main(int argc, const char ** argv)
#endif
pinocchio::Model model;
std::string filename = PINOCCHIO_SOURCE_DIR"/models/simple_humanoid.urdf";
std::string filename = PINOCCHIO_MODEL_DIR + std::string("/simple_humanoid.urdf");
if(argc>1) filename = argv[1];
bool with_ff = true;
......
......@@ -25,7 +25,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename Base::VectorXs VectorXs;
......@@ -35,7 +35,7 @@ namespace pinocchio
const std::string & library_name = "cg_rnea_eval")
: Base(model,model.nq+2*model.nv,model.nv,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
ad_v = ADTangentVectorType(model.nv); ad_v.setZero();
ad_a = ADTangentVectorType(model.nv); ad_a.setZero();
x = VectorXs::Zero(Base::getInputDimension());
......@@ -113,7 +113,7 @@ namespace pinocchio
VectorXs x;
VectorXs res;
ADCongigVectorType ad_q, ad_q_plus;
ADConfigVectorType ad_q, ad_q_plus;
ADTangentVectorType ad_dq, ad_v, ad_a;
};
......@@ -124,7 +124,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename Base::VectorXs VectorXs;
......@@ -134,7 +134,7 @@ namespace pinocchio
const std::string & library_name = "cg_aba_eval")
: Base(model,model.nq+2*model.nv,model.nv,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
ad_v = ADTangentVectorType(model.nv); ad_v.setZero();
ad_tau = ADTangentVectorType(model.nv); ad_tau.setZero();
x = VectorXs::Zero(Base::getInputDimension());
......@@ -144,7 +144,7 @@ namespace pinocchio
da_dv = MatrixXs::Zero(model.nv,model.nv);
da_dtau = MatrixXs::Zero(model.nv,model.nv);
}
void buildMap()
{
CppAD::Independent(ad_X);
......@@ -212,7 +212,7 @@ namespace pinocchio
VectorXs x;
VectorXs res;
ADCongigVectorType ad_q, ad_q_plus;
ADConfigVectorType ad_q, ad_q_plus;
ADTangentVectorType ad_dq, ad_v, ad_tau;
};
......@@ -223,7 +223,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename Base::VectorXs VectorXs;
......@@ -233,7 +233,7 @@ namespace pinocchio
const std::string & library_name = "cg_crba_eval")
: Base(model,model.nq,(model.nv*(model.nv+1))/2,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
x = VectorXs::Zero(Base::getInputDimension());
res = VectorXs::Zero(Base::getOutputDimension());
......@@ -302,7 +302,7 @@ namespace pinocchio
VectorXs x;
VectorXs res;
ADCongigVectorType ad_q;
ADConfigVectorType ad_q;
};
template<typename _Scalar>
......@@ -312,7 +312,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename Base::VectorXs VectorXs;
......@@ -322,7 +322,7 @@ namespace pinocchio
const std::string & library_name = "cg_minv_eval")
: Base(model,model.nq,(model.nv*(model.nv+1))/2,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
x = VectorXs::Zero(Base::getInputDimension());
res = VectorXs::Zero(Base::getOutputDimension());
......@@ -388,7 +388,7 @@ namespace pinocchio
VectorXs x;
VectorXs res;
ADCongigVectorType ad_q;
ADConfigVectorType ad_q;
};
template<typename _Scalar>
......@@ -398,7 +398,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename PINOCCHIO_EIGEN_PLAIN_ROW_MAJOR_TYPE(MatrixXs) RowMatrixXs;
......@@ -413,7 +413,7 @@ namespace pinocchio
const std::string & library_name = "cg_partial_rnea_eval")
: Base(model,model.nq+2*model.nv,3*model.nv*model.nv,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
ad_v = ADTangentVectorType(model.nv); ad_v.setZero();
ad_a = ADTangentVectorType(model.nv); ad_a.setZero();
......@@ -496,7 +496,7 @@ namespace pinocchio
ADMatrixXs ad_dtau_dq, ad_dtau_dv, ad_dtau_da;
MatrixXs dtau_dq, dtau_dv, dtau_da;
ADCongigVectorType ad_q;
ADConfigVectorType ad_q;
ADTangentVectorType ad_v, ad_a;
};
......@@ -507,7 +507,7 @@ namespace pinocchio
typedef typename Base::Scalar Scalar;
typedef typename Base::Model Model;
typedef typename Base::ADCongigVectorType ADCongigVectorType;
typedef typename Base::ADConfigVectorType ADConfigVectorType;
typedef typename Base::ADTangentVectorType ADTangentVectorType;
typedef typename Base::MatrixXs MatrixXs;
typedef typename PINOCCHIO_EIGEN_PLAIN_ROW_MAJOR_TYPE(MatrixXs) RowMatrixXs;
......@@ -522,7 +522,7 @@ namespace pinocchio
const std::string & library_name = "cg_partial_aba_eval")
: Base(model,model.nq+2*model.nv,3*model.nv*model.nv,function_name,library_name)
{
ad_q = ADCongigVectorType(model.nq); ad_q = neutral(model);
ad_q = ADConfigVectorType(model.nq); ad_q = neutral(ad_model);
ad_v = ADTangentVectorType(model.nv); ad_v.setZero();
ad_tau = ADTangentVectorType(model.nv); ad_tau.setZero();
......@@ -605,7 +605,7 @@ namespace pinocchio
ADMatrixXs ad_dddq_dq, ad_dddq_dv, ad_dddq_dtau;
MatrixXs dddq_dq, dddq_dv, dddq_dtau;
ADCongigVectorType ad_q;
ADConfigVectorType ad_q;
ADTangentVectorType ad_v, ad_tau;
};
......
......@@ -36,10 +36,10 @@ namespace pinocchio
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic,Options|Eigen::RowMajor> RowMatrixXs;
typedef Eigen::Matrix<ADScalar,Eigen::Dynamic,1,Options> ADVectorXs;
typedef typename Model::ConfigVectorType CongigVectorType;
typedef typename Model::ConfigVectorType ConfigVectorType;
typedef typename Model::TangentVectorType TangentVectorType;
typedef typename ADModel::ConfigVectorType ADCongigVectorType;
typedef typename ADModel::ConfigVectorType ADConfigVectorType;
typedef typename ADModel::TangentVectorType ADTangentVectorType;
typedef CppAD::ADFun<CGScalar> ADFun;
......@@ -161,7 +161,7 @@ namespace pinocchio
ADVectorXs ad_X, ad_Y;
ADFun ad_fun;
ADCongigVectorType ad_q, ad_q_plus;
ADConfigVectorType ad_q, ad_q_plus;
ADTangentVectorType ad_dq, ad_v, ad_a;
VectorXs y;
......
......@@ -49,9 +49,9 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
ADData ad_data(ad_model);
// Sample random configuration
typedef Model::ConfigVectorType CongigVectorType;
typedef Model::ConfigVectorType ConfigVectorType;
typedef Model::TangentVectorType TangentVectorType;
CongigVectorType q(model.nq);
ConfigVectorType q(model.nq);
q = pinocchio::randomConfiguration(model);
TangentVectorType v(TangentVectorType::Random(model.nv));
......@@ -69,10 +69,10 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
rnea_partial_da.triangularView<Eigen::StrictlyLower>()
= rnea_partial_da.transpose().triangularView<Eigen::StrictlyLower>();
typedef ADModel::ConfigVectorType ADCongigVectorType;
typedef ADModel::ConfigVectorType ADConfigVectorType;
typedef ADModel::TangentVectorType ADTangentVectorType;
ADCongigVectorType ad_q = q.cast<ADScalar>();
ADConfigVectorType ad_q = q.cast<ADScalar>();
ADTangentVectorType ad_dq = ADTangentVectorType::Zero(model.nv);
ADTangentVectorType ad_v = v.cast<ADScalar>();
ADTangentVectorType ad_a = a.cast<ADScalar>();
......@@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(test_rnea_derivatives)
// dtau_dq
{
CppAD::Independent(ad_dq);
ADCongigVectorType ad_q_plus = pinocchio::integrate(ad_model,ad_q,ad_dq);
ADConfigVectorType ad_q_plus = pinocchio::integrate(ad_model,ad_q,ad_dq);
pinocchio::rnea(ad_model,ad_data,ad_q_plus,ad_v,ad_a);
VectorXAD Y(model.nv);
......@@ -175,9 +175,9 @@ BOOST_AUTO_TEST_CASE(test_aba_derivatives)
ADData ad_data(ad_model);
// Sample random configuration
typedef Model::ConfigVectorType CongigVectorType;
typedef Model::ConfigVectorType ConfigVectorType;
typedef Model::TangentVectorType TangentVectorType;
CongigVectorType q(model.nq);
ConfigVectorType q(model.nq);
q = pinocchio::randomConfiguration(model);
TangentVectorType v(TangentVectorType::Random(model.nv));
......@@ -195,10 +195,10 @@ BOOST_AUTO_TEST_CASE(test_aba_derivatives)
aba_partial_dtau.triangularView<Eigen::StrictlyLower>()
= aba_partial_dtau.transpose().triangularView<Eigen::StrictlyLower>();
typedef ADModel::ConfigVectorType ADCongigVectorType;
typedef ADModel::ConfigVectorType ADConfigVectorType;
typedef ADModel::TangentVectorType ADTangentVectorType;
ADCongigVectorType ad_q = q.cast<ADScalar>();
ADConfigVectorType ad_q = q.cast<ADScalar>();
ADTangentVectorType ad_dq = ADTangentVectorType::Zero(model.nv);
ADTangentVectorType ad_v = v.cast<ADScalar>();
ADTangentVectorType ad_tau = tau.cast<ADScalar>();
......@@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(test_aba_derivatives)
// dddq_dq
{
CppAD::Independent(ad_dq);
ADCongigVectorType ad_q_plus = pinocchio::integrate(ad_model,ad_q,ad_dq);
ADConfigVectorType ad_q_plus = pinocchio::integrate(ad_model,ad_q,ad_dq);
pinocchio::aba(ad_model,ad_data,ad_q_plus,ad_v,ad_tau);
VectorXAD Y(model.nv);
......
......@@ -47,18 +47,18 @@ BOOST_AUTO_TEST_CASE(test_mass_matrix)
ADData ad_data(ad_model);
// Sample random configuration
typedef Model::ConfigVectorType CongigVectorType;
typedef Model::ConfigVectorType ConfigVectorType;
typedef Model::TangentVectorType TangentVectorType;
CongigVectorType q(model.nq);
ConfigVectorType q(model.nq);
q = pinocchio::randomConfiguration(model);
TangentVectorType v(TangentVectorType::Random(model.nv));
TangentVectorType a(TangentVectorType::Random(model.nv));
typedef ADModel::ConfigVectorType ADCongigVectorType;
typedef ADModel::ConfigVectorType ADConfigVectorType;
typedef ADModel::TangentVectorType ADTangentVectorType;
ADCongigVectorType ad_q = q.cast<ADScalar>();
ADConfigVectorType ad_q = q.cast<ADScalar>();
ADTangentVectorType ad_v = v.cast<ADScalar>();
ADTangentVectorType ad_a = a.cast<ADScalar>();
......@@ -145,18 +145,18 @@ BOOST_AUTO_TEST_CASE(test_kinematics_jacobian)
ADData ad_data(ad_model);
// Sample random configuration
typedef Model::ConfigVectorType CongigVectorType;
typedef Model::ConfigVectorType ConfigVectorType;
typedef Model::TangentVectorType TangentVectorType;
CongigVectorType q(model.nq);
ConfigVectorType q(model.nq);
q = pinocchio::randomConfiguration(model);
TangentVectorType v(TangentVectorType::Random(model.nv));
TangentVectorType a(TangentVectorType::Random(model.nv));
typedef ADModel::ConfigVectorType ADCongigVectorType;
typedef ADModel::ConfigVectorType ADConfigVectorType;
typedef ADModel::TangentVectorType ADTangentVectorType;
ADCongigVectorType ad_q = q.cast<ADScalar>();
ADConfigVectorType ad_q = q.cast<ADScalar>();
ADTangentVectorType ad_v = v.cast<ADScalar>();
ADTangentVectorType ad_a = a.cast<ADScalar>();
......
......@@ -47,18 +47,18 @@ BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
ADData ad_data(ad_model);
// Sample random configuration
typedef Model::ConfigVectorType CongigVectorType;
typedef Model::ConfigVectorType ConfigVectorType;
typedef Model::TangentVectorType TangentVectorType;
CongigVectorType q(model.nq);
ConfigVectorType q(model.nq);
q = pinocchio::randomConfiguration(model);
TangentVectorType v(TangentVectorType::Random(model.nv));
TangentVectorType a(TangentVectorType::Random(model.nv));
typedef ADModel::ConfigVectorType ADCongigVectorType;
typedef ADModel::ConfigVectorType ADConfigVectorType;
typedef ADModel::TangentVectorType ADTangentVectorType;
ADCongigVectorType ad_q = q.cast<ADScalar>();
ADConfigVectorType ad_q = q.cast<ADScalar>();
ADTangentVectorType ad_v = v.cast<ADScalar>();
ADTangentVectorType ad_a = a.cast<ADScalar>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment