Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy robot model generated code cannot instantiate a corresponding system #200

Open
mustang66ytz opened this issue Jul 28, 2021 · 0 comments

Comments

@mustang66ytz
Copy link

I am following the ct rbd tutorial to generate code for Fancy robot, whose .kindsl and .tdtsl files are provided in the robcogen.
When I am instantiating my robot system with this line of code: std::shared_ptr<MyRobotNonLinearSystem> myrobot(new MyRobotNonLinearSystem());, I got the following errors:

/home/robot-control/ct_ws/devel/include/ct/iit/rbd/robcogen_commons.h: In instantiation of ‘void iit::rbd::ctransform_Ia_prismatic(iit::rbd::MatrixBase&, iit::rbd::MatrixBase&, iit::rbd::MatrixBase&) [with D1 = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6>; D2 = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6>; D3 = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6>; iit::rbd::MatrixBase = Eigen::MatrixBase<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6> >; iit::rbd::MatrixBase = Eigen::MatrixBase<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6> >; iit::rbd::MatrixBase = Eigen::MatrixBase<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 6, 0, 6, 6> >]’:
/home/robot-control/ct_ws/src/control-toolbox/ct_models/include/ct/models/my_robot/generated/forward_dynamics.impl.h:131:28: required from ‘void iit::Fancy::dyn::tpl::ForwardDynamics::fd(iit::Fancy::dyn::tpl::ForwardDynamics::JointState&, const JointState&, const JointState&, const ExtForces&) [with TRAIT = ct::core::internal::CppADCodegenTrait; iit::Fancy::dyn::tpl::ForwardDynamics::JointState = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 5, 1, 0, 5, 1>; typename TRAIT::Scalar = CppAD::AD<CppAD::cg::CG >; iit::Fancy::dyn::tpl::ForwardDynamics::ExtForces = iit::Fancy::LinkDataMap<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 1, 0, 6, 1> >; typename iit::rbd::Core::ForceVector = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 1, 0, 6, 1>]’
/home/robot-control/ct_ws/src/control-toolbox/ct_models/include/ct/models/my_robot/generated/forward_dynamics.h:162:7: required from ‘void iit::Fancy::dyn::tpl::ForwardDynamics::fd(iit::Fancy::dyn::tpl::ForwardDynamics::JointState&, const JointState&, const JointState&, const JointState&, const ExtForces&) [with TRAIT = ct::core::internal::CppADCodegenTrait; iit::Fancy::dyn::tpl::ForwardDynamics::JointState = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 5, 1, 0, 5, 1>; typename TRAIT::Scalar = CppAD::AD<CppAD::cg::CG >; iit::Fancy::dyn::tpl::ForwardDynamics::ExtForces = iit::Fancy::LinkDataMap<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 1, 0, 6, 1> >; typename iit::rbd::Core::ForceVector = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 1, 0, 6, 1>]’
/home/robot-control/ct_ws/devel/include/ct/rbd/robot/Dynamics.h:255:5: required from ‘typename std::enable_if<(! B), void>::type ct::rbd::Dynamics<RBD, NEE>::FixBaseForwardDynamics(const JointState_t&, const control_vector_t&, ct::rbd::Dynamics<RBD, NEE>::ExtLinkForces_t&, ct::rbd::Dynamics<RBD, NEE>::JointAcceleration_t&) [with bool B = false; RBD = ct::rbd::RobCoGenContainer<iit::Fancy::tpl::Traits<CppAD::AD<CppAD::cg::CG > >, iit::Fancy::LinkDataMap, ct::rbd::MyRobot::Utils<CppAD::AD<CppAD::cg::CG > > >; long unsigned int NEE = 1; typename std::enable_if<(! B), void>::type = void; ct::rbd::Dynamics<RBD, NEE>::JointState_t = ct::rbd::JointState<5, CppAD::AD<CppAD::cg::CG > >; typename RBD::SCALAR = CppAD::AD<CppAD::cg::CG >; ct::rbd::Dynamics<RBD, NEE>::control_vector_t = Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 5, 1, 0, 5, 1>; ct::rbd::Dynamics<RBD, NEE>::ExtLinkForces_t = iit::Fancy::LinkDataMap<Eigen::Matrix<CppAD::AD<CppAD::cg::CG >, 6, 1, 0, 6, 1> >; ct::rbd::Dynamics<RBD, NEE>::JointAcceleration_t = ct::rbd::JointAcceleration<5, CppAD::AD<CppAD::cg::CG > >]’
/home/robot-control/ct_ws/devel/include/ct/rbd/systems/FixBaseFDSystem.h:123:9: required from ‘void ct::rbd::FixBaseFDSystem<RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS>::computeControlledDynamics(const state_vector_t&, const SCALAR&, const control_vector_t&, ct::rbd::FixBaseFDSystem<RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS>::state_vector_t&) [with RBDDynamics = ct::rbd::Dynamics<ct::rbd::RobCoGenContainer<iit::Fancy::tpl::Traits<CppAD::AD<CppAD::cg::CG > >, iit::Fancy::LinkDataMap, ct::rbd::MyRobot::Utils<CppAD::AD<CppAD::cg::CG > > >, 1>; long unsigned int ACT_STATE_DIM = 0; bool EE_ARE_CONTROL_INPUTS = false; ct::rbd::FixBaseFDSystem<RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS>::state_vector_t = ct::core::StateVector<10, CppAD::AD<CppAD::cg::CG > >; ct::rbd::FixBaseFDSystem<RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS>::SCALAR = CppAD::AD<CppAD::cg::CG >; ct::rbd::FixBaseFDSystem<RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS>::control_vector_t = ct::core::ControlVector<5, CppAD::AD<CppAD::cg::CG > >]’
/home/robot-control/ct_ws/src/control-toolbox/ct_models/src/my_robot/codegen/simple_test.cpp:42:1: required from here
/home/robot-control/ct_ws/devel/include/ct/iit/rbd/robcogen_commons.h:479:42: error: no matching function for call to ‘iit::rbd::internal::Mat3x3Coefficients<CppAD::AD<CppAD::cg::CG > >::Mat3x3Coefficients(const CppAD::AD<CppAD::cg::CG >&, const CppAD::AD<CppAD::cg::CG >&, int, const CppAD::AD<CppAD::cg::CG >&, const CppAD::AD<CppAD::cg::CG >&, int, const CppAD::AD<CppAD::cg::CG >&, const CppAD::AD<CppAD::cg::CG >&, int)’
internal::Mat3x3Coefficients C(
^
compilation terminated due to -Wfatal-errors.

MyRobot.h file is like this:

#pragma once
#include <Eigen/Core>
#include <Eigen/StdVector>
#include "generated/declarations.h"
#include "generated/jsim.h"
#include "generated/jacobians.h"
#include "generated/traits.h"
#include "generated/forward_dynamics.h"
#include "generated/inertia_properties.h"
#include "generated/inverse_dynamics.h"
#include "generated/transforms.h"
#include "generated/link_data_map.h"
// define namespace and base
#define ROBCOGEN_NS Fancy
#define TARGET_NS MyRobot
// define the links
#define CT_BASE fr_base0
#define CT_L0 fr_link1
#define CT_L1 fr_link2
#define CT_L2 fr_link3
#define CT_L3 fr_link4
#define CT_L4 fr_link5

// define single end effector (could also be multiple)
#define CT_N_EE 1
#define CT_EE0 ee
#define CT_EE0_IS_ON_LINK 5
#define CT_EE0_FIRST_JOINT 0
#define CT_EE0_LAST_JOINT 4
#include <ct/rbd/robot/robcogen/robcogenHelpers.h>

Since I am using the Fancy model provided by the RobCoGen, I suspect that should be correct, but why this error occurred?
Thanks for any suggestions!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant