21 #include <pinocchio/spatial/skew.hpp> 27 using namespace tasks;
32 const double frictionCoefficient,
33 const double minNormalForce,
34 const double maxNormalForce)
36 m_motionTask(name, robot, frameName),
37 m_forceInequality(name, 5, 3),
38 m_forceRegTask(name, 3, 3),
39 m_contactNormal(contactNormal),
40 m_mu(frictionCoefficient),
41 m_fMin(minNormalForce),
42 m_fMax(maxNormalForce) {
53 motion_mask << 1., 1., 1., 0., 0., 0.;
63 const int n_in = 4 * 1 + 1;
64 const int n_var = 3 * 1;
65 Matrix B = Matrix::Zero(n_in, n_var);
66 Vector lb = -1e10 * Vector::Ones(n_in);
75 B.block<1, 3>(1, 0) = (t1 -
m_mu * m_contactNormal).transpose();
76 B.block<1, 3>(2, 0) = (-t2 -
m_mu * m_contactNormal).transpose();
77 B.block<1, 3>(3, 0) = (t2 -
m_mu * m_contactNormal).transpose();
79 B.block<1, 3>(n_in - 1, 0) = m_contactNormal.transpose();
91 "Size of f is wrong - needs to be " + std::to_string(
n_force()));
105 Eigen::Matrix3d
A = Eigen::Matrix3d::Zero();
128 "Size of Kp vector needs to equal 3");
136 "Size of Kd vector needs to equal 3");
144 contactNormal.size() == 3,
145 "Size of contact normal vector needs to equal 3");
146 if (contactNormal.size() != 3)
return false;
154 "Friction coefficient needs to be positive");
155 if (frictionCoefficient <= 0.0)
return false;
156 m_mu = frictionCoefficient;
163 minNormalForce > 0.0 && minNormalForce <=
m_fMax,
164 "The minimal normal force needs to be greater than 0 and less than or " 165 "equal to the maximum force.");
166 if (minNormalForce <= 0.0 || minNormalForce >
m_fMax)
return false;
175 "The maximal normal force needs to be greater " 176 "than or equal to the minimal force");
177 if (maxNormalForce <
m_fMin)
return false;
186 f_ref.size() == 3,
"The size of the force reference needs to equal 3");
const Vector & lowerBound() const
bool setLowerBound(ConstRefVector lb)
bool setUpperBound(ConstRefVector ub)
const Vector & Kp() const
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
void useLocalFrame(bool local_frame)
Specifies if the jacobian and desired acceloration should be expressed in the local frame or the loca...
virtual bool setMatrix(ConstRefMatrix A)
virtual void setMask(math::ConstRefVector mask)
void setReference(TrajectorySample &ref)
const Vector & Kd() const
const Vector & upperBound() const
Wrapper for a robot based on pinocchio.
bool setVector(ConstRefVector b)
const ConstraintBase & compute(const double t, ConstRefVector q, ConstRefVector v, Data &data)
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
int dim() const
Return the dimension of the task. should be overloaded in the child class.
const ConstraintBase & getConstraint() const