10 #ifndef CROCODDYL_MULTIBODY_IMPULSES_IMPULSE_6D_HPP_
11 #define CROCODDYL_MULTIBODY_IMPULSES_IMPULSE_6D_HPP_
13 #include <pinocchio/multibody/data.hpp>
14 #include <pinocchio/spatial/motion.hpp>
16 #include "crocoddyl/multibody/fwd.hpp"
17 #include "crocoddyl/multibody/impulse-base.hpp"
21 template <
typename _Scalar>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
26 typedef _Scalar Scalar;
32 typedef typename MathBase::Vector2s Vector2s;
33 typedef typename MathBase::Vector3s Vector3s;
34 typedef typename MathBase::VectorXs VectorXs;
35 typedef typename MathBase::MatrixXs MatrixXs;
36 typedef typename MathBase::Matrix3s Matrix3s;
46 boost::shared_ptr<StateMultibody> state,
const pinocchio::FrameIndex
id,
47 const pinocchio::ReferenceFrame type = pinocchio::ReferenceFrame::LOCAL);
56 virtual void calc(
const boost::shared_ptr<ImpulseDataAbstract>& data,
57 const Eigen::Ref<const VectorXs>& x);
65 virtual void calcDiff(
const boost::shared_ptr<ImpulseDataAbstract>& data,
66 const Eigen::Ref<const VectorXs>& x);
74 virtual void updateForce(
const boost::shared_ptr<ImpulseDataAbstract>& data,
75 const VectorXs& force);
80 virtual boost::shared_ptr<ImpulseDataAbstract>
createData(
81 pinocchio::DataTpl<Scalar>*
const data);
88 virtual void print(std::ostream& os)
const;
96 template <
typename _Scalar>
98 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
99 typedef _Scalar Scalar;
102 typedef typename MathBase::Matrix3s Matrix3s;
103 typedef typename MathBase::Matrix6xs Matrix6xs;
104 typedef typename MathBase::MatrixXs MatrixXs;
105 typedef typename pinocchio::SE3Tpl<Scalar> SE3;
106 typedef typename pinocchio::MotionTpl<Scalar> Motion;
107 typedef typename pinocchio::ForceTpl<Scalar> Force;
109 template <
template <
typename Scalar>
class Model>
111 pinocchio::DataTpl<Scalar>*
const data)
113 lwaMl(SE3::Identity()),
115 f_local(Force::Zero()),
116 dv0_local_dq(6, model->get_state()->get_nv()),
117 fJf(6, model->get_state()->get_nv()),
118 v_partial_dq(6, model->get_state()->get_nv()),
119 v_partial_dv(6, model->get_state()->get_nv()),
120 fJf_df(6, model->get_state()->get_nv()) {
121 frame = model->get_id();
123 model->get_state()->get_pinocchio()->frames[model->get_id()].placement;
124 fXj =
jMf.inverse().toActionMatrix();
126 v_partial_dq.setZero();
127 v_partial_dv.setZero();
130 vv_world_skew.setZero();
131 vw_world_skew.setZero();
149 Matrix6xs dv0_local_dq;
151 Matrix6xs v_partial_dq;
152 Matrix6xs v_partial_dv;
155 Matrix3s vv_world_skew;
156 Matrix3s vw_world_skew;
167 #include "crocoddyl/multibody/impulses/impulse-6d.hxx"
virtual void calcDiff(const boost::shared_ptr< ImpulseDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the derivatives of the 3d impulse holonomic constraint.
virtual void print(std::ostream &os) const
Print relevant information of the 6d impulse model.
virtual boost::shared_ptr< ImpulseDataAbstract > createData(pinocchio::DataTpl< Scalar > *const data)
Create the 3d impulse data.
virtual void calc(const boost::shared_ptr< ImpulseDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the 3d impulse Jacobian.
virtual void updateForce(const boost::shared_ptr< ImpulseDataAbstract > &data, const VectorXs &force)
Convert the force into a stack of spatial forces.
ImpulseModel6DTpl(boost::shared_ptr< StateMultibody > state, const pinocchio::FrameIndex id, const pinocchio::ReferenceFrame type=pinocchio::ReferenceFrame::LOCAL)
Initialize the 6d impulse model.
pinocchio::ReferenceFrame type_
Type of contact.
pinocchio::FrameIndex id_
Reference frame id of the contact.
State multibody representation.
pinocchio::FrameIndex frame
Frame index of the contact frame.
SE3 jMf
Local frame placement of the contact frame.
PinocchioData * pinocchio
Pinocchio data.
pinocchio::FrameIndex frame
Frame index of the contact frame.
SE3 jMf
Local frame placement of the contact frame.
MatrixXs Jc
Contact Jacobian.
Force f
Contact force expressed in the coordinate defined by type.