40 :ifopt::ConstraintSet(kSpecifyLater,
"Force-Constraint-" + id::
EEForceNodes(ee))
44 mu_ = terrain->GetFrictionCoeff();
59 SetRows(constraint_count);
71 int phase =
ee_force_->GetPhase(f_node_id);
74 Vector3d f = force_nodes.at(f_node_id).p();
77 g(row++) = f.transpose() * n;
81 g(row++) = f.transpose() * (t1 -
mu_*n);
82 g(row++) = f.transpose() * (t1 +
mu_*n);
85 g(row++) = f.transpose() * (t2 -
mu_*n);
86 g(row++) = f.transpose() * (t2 +
mu_*n);
92 ForceConstraint::VecBound
98 bounds.push_back(ifopt::Bounds(0.0,
fn_max_));
99 bounds.push_back(ifopt::BoundSmallerZero);
100 bounds.push_back(ifopt::BoundGreaterZero);
101 bounds.push_back(ifopt::BoundSmallerZero);
102 bounds.push_back(ifopt::BoundGreaterZero);
118 int phase =
ee_force_->GetPhase(f_node_id);
124 for (
auto dim : {
X,
Y,
Z}) {
129 jac.coeffRef(row_reset++, idx) = n(dim);
130 jac.coeffRef(row_reset++, idx) = t1(dim)-
mu_*n(dim);
131 jac.coeffRef(row_reset++, idx) = t1(dim)+
mu_*n(dim);
132 jac.coeffRef(row_reset++, idx) = t2(dim)-
mu_*n(dim);
133 jac.coeffRef(row_reset++, idx) = t2(dim)+
mu_*n(dim);
144 auto force_nodes =
ee_force_->GetNodes();
147 int phase =
ee_force_->GetPhase(f_node_id);
148 int ee_node_id =
ee_motion_->GetNodeIDAtStartOfPhase(phase);
151 Vector3d f = force_nodes.at(f_node_id).p();
153 for (
auto dim : {
X_,
Y_}) {
163 jac.coeffRef(row_reset++, idx) = f.transpose()*dn;
166 jac.coeffRef(row_reset++, idx) = f.transpose()*(dt1-
mu_*dn);
167 jac.coeffRef(row_reset++, idx) = f.transpose()*(dt1+
mu_*dn);
170 jac.coeffRef(row_reset++, idx) = f.transpose()*(dt2-
mu_*dn);
171 jac.coeffRef(row_reset++, idx) = f.transpose()*(dt2+
mu_*dn);
std::vector< int > pure_stance_force_node_ids_
Nodes that are associated to either swing or stance phases.
PhaseNodes::Ptr ee_force_
the current xyz foot forces.
double mu_
friction coeff between robot feet and terrain.
void FillJacobianBlock(std::string var_set, Jacobian &) const override
ForceConstraint(const HeightMap::Ptr &terrain, double force_limit_in_normal_direction, EE endeffector_id)
Constructs a force contraint.
virtual void InitVariableDependedQuantities(const VariablesPtr &x) override
double fn_max_
force limit in normal direction.
VecBound GetBounds() const override
PhaseNodes::Ptr ee_motion_
the current xyz foot positions.
EE ee_
The endeffector force to be constrained.
int n_constraints_per_node_
number of constraint for each node.
static std::string EEMotionNodes(uint ee)
VectorXd GetValues() const override
static std::string EEForceNodes(uint ee)
HeightMap::Ptr terrain_
gradient information at every position (x,y).
std::shared_ptr< HeightMap > Ptr