20 template <
typename Kinematics,
size_t OUTPUTS,
size_t NJOINTS,
typename SCALAR>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
38 this->
J_.template block<3, NJOINTS + 6>(row, 0).setZero();
56 RBDState_t state1 = state;
59 SCALAR eps_ = sqrt(Eigen::NumTraits<SCALAR>::epsilon());
62 for (
size_t i = 0;
i < NJOINTS;
i++)
66 state1.joints().getPositions()(
i) += h;
68 dJdt += (Jc1 - Jc0) / h * state.joints().getVelocities()(
i);
69 state1.joints().getPositions()(
i) = state.joints().getPositions()(
i);
80 Eigen::Matrix<SCALAR, 3, NJOINTS + 6> dJdt_eeId;
81 Eigen::Matrix<SCALAR, 6, NJOINTS> Jc_geometric;
82 Eigen::Matrix<SCALAR, 3, NJOINTS> Jc_Rotational, Jc_Translational, dJdt_joints;
83 Eigen::Matrix<SCALAR, 3, 1> dJidqj;
84 Eigen::Matrix<SCALAR, 3, 6> dJdt_base;
85 Eigen::Matrix<SCALAR, 3, 1> eeVelocityWrtBase;
89 for (
size_t ee = 0; ee < ee_indices_.size(); ee++)
91 if (eeInContact_[ee_indices_[ee]])
95 kinematics_.
robcogen().getJacobianBaseEEbyId(ee_indices_[ee], state.joints().getPositions());
96 Jc_Rotational = Jc_geometric.template topRows<3>();
97 Jc_Translational = Jc_geometric.template bottomRows<3>();
100 dJdt_joints.setZero();
101 for (
size_t i = 0;
i < NJOINTS;
i++)
103 for (
size_t j = 0; j < NJOINTS; j++)
107 dJidqj = (Jc_Rotational.template block<3, 1>(0, j))
108 .template cross(Jc_Translational.template block<3, 1>(0,
i));
112 dJidqj = (Jc_Rotational.template block<3, 1>(0,
i))
113 .template cross(Jc_Translational.template block<3, 1>(0, j));
115 dJdt_joints.template block<3, 1>(0,
i) += dJidqj * state.joints().getVelocities()(j);
120 eeVelocityWrtBase = Jc_Translational * state.joints().getVelocities();
121 dJdt_base(1, 2) = eeVelocityWrtBase(0);
122 dJdt_base(2, 1) = -eeVelocityWrtBase(0);
123 dJdt_base(0, 2) = -eeVelocityWrtBase(1);
124 dJdt_base(2, 0) = eeVelocityWrtBase(1);
125 dJdt_base(0, 1) = eeVelocityWrtBase(2);
126 dJdt_base(1, 0) = -eeVelocityWrtBase(2);
129 dJdt.template block<3, 6>(ee_indices_[ee] * 3, 0) = dJdt_base;
130 dJdt.template block<3, NJOINTS>(ee_indices_[ee] * 3, 6) = dJdt_joints;
138 for (
size_t ee = 0; ee < ee_indices_.size(); ee++)
140 if (eeInContact_[ee_indices_[ee]])
142 Eigen::Matrix<SCALAR, 3, NJOINTS + 6> J_eeId;
143 kindr::Position<SCALAR, 3> eePosition =
145 Eigen::Matrix<SCALAR, 3, NJOINTS> J_single =
147 .getJacobianBaseEEbyId(ee_indices_[ee], state.joints().getPositions())
148 .
template bottomRows<3>();
150 Matrix3s::Identity(), eePosition.toImplementation(), J_single, J_eeId);
151 Jc.template block<3, NJOINTS + 6>(ee_indices_[ee] * 3, 0) = J_eeId;
163 template <
typename Kinematics,
size_t OUTPUTS,
size_t NJOINTS>
Definition: ConstraintJacobian.h:21
std::vector< int > ee_indices_
Definition: ConstraintJacobian.h:44
RBD & robcogen()
Definition: Kinematics.h:360
Definition: OperationalJacobianBase.h:20
static const size_t BASE_DOF
Definition: ConstraintJacobian.h:41
joint states and base states
Definition: RBDState.h:27
virtual void getJacobianOriginDerivative(const RBDState_t &state, jacobian_t &dJdt) override
Definition: ConstraintJacobian.h:73
Eigen::Matrix< SCALAR, 3, 3 > Matrix3s
Definition: ConstraintJacobian.h:28
void SetBlockZero(const int &row)
Definition: ConstraintJacobian.h:34
virtual ~ConstraintJacobian()
Definition: ConstraintJacobian.h:32
Position3Tpl getEEPositionInBase(size_t eeID, const typename JointState_t::Position &jointPosition)
Definition: Kinematics.h:145
virtual void getJacobianOrigin(const RBDState_t &state, jacobian_t &Jc) override
Definition: ConstraintJacobian.h:135
CppAD::AD< CppAD::cg::CG< double > > SCALAR
const jacobian_t & dJdt()
This method gets the time derivative of the floating-base Jacobian.
Definition: OperationalJacobianBase.h:60
std::array< bool, Kinematics::NUM_EE > eeInContact_
Definition: ConstraintJacobian.h:45
OperationalJacobianBase< OUTPUTS, NJOINTS, SCALAR >::jacobian_t jacobian_t
Definition: ConstraintJacobian.h:27
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef RBDState< NJOINTS, SCALAR > RBDState_t
Definition: ConstraintJacobian.h:26
static void FromBaseJacToInertiaJacTranslation(const Matrix3s &i_R_b, const Vector3s &b_r_point, const Eigen::Matrix< SCALAR, 3, NUM_JOINTS > &b_J_point, Eigen::Matrix< SCALAR, 3, NUM_JOINTS+6 > &i_J_point)
Definition: FrameJacobian.h:77
void getJacobianOriginDerivativeNumdiff(const RBDState_t &state, jacobian_t &dJdt)
Definition: ConstraintJacobian.h:48
size_t c_size_
Definition: ConstraintJacobian.h:43
ConstraintJacobian()
Definition: ConstraintJacobian.h:30
A general class for computing Kinematic properties.
Definition: Kinematics.h:27
jacobian_t J_
Definition: OperationalJacobianBase.h:151
const jacobian_t & J()
This method gets the floating-base Jacobian.
Definition: OperationalJacobianBase.h:49