27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
62 unsigned int robotIndex,
63 const std::string & body,
65 const Eigen::Matrix6d & dof = Eigen::Matrix6d::Identity(),
66 double stiffness = 5.0,
67 double weight = 1000.0,
68 double forceThresh = 3.,
69 double torqueThresh = 1.,
70 std::pair<double, double> forceGain = defaultFGain,
71 std::pair<double, double> torqueGain = defaultTGain);
100 unsigned int robotIndex,
101 const std::string & body,
103 double stiffness = 5.0,
104 double weight = 1000.0,
105 double forceThresh = 3.,
106 double torqueThresh = 1.,
107 std::pair<double, double> forceGain = defaultFGain,
108 std::pair<double, double> torqueGain = defaultTGain);
129 efTask_->positionTask->stiffness(s);
130 efTask_->orientationTask->stiffness(s);
133 double stiffness() {
return efTask_->positionTask->stiffness(); }
138 efTask_->positionTask->weight(w);
139 efTask_->orientationTask->weight(w);
142 double weight() {
return efTask_->positionTask->weight(); }
155 void forceGain(std::pair<double, double> t) { forceGain_ = t; }
157 std::pair<double, double>
forceGain() {
return forceGain_; }
160 void torqueGain(std::pair<double, double> t) { torqueGain_ = t; }
162 std::pair<double, double>
torqueGain() {
return torqueGain_; }
165 void dof(
const Eigen::Matrix6d & dof) { dof_ =
dof; }
167 Eigen::Matrix6d
dof() {
return dof_; }
174 const std::vector<std::string> & activeJointsName,
175 const std::map<std::string, std::vector<std::array<int, 2>>> & activeDofs = {})
override;
178 const std::vector<std::string> & unactiveJointsName,
179 const std::map<std::string, std::vector<std::array<int, 2>>> & unactiveDofs = {})
override;
183 Eigen::VectorXd
eval()
const override {
return wrench_.vector(); }
185 Eigen::VectorXd
speed()
const override
187 return robots_.robot(rIndex_).mbc().bodyVelW[robots_.robot(rIndex_).bodyIndexByName(sensor_.parentBody())].vector();
191 sva::PTransformd computePose();
193 std::shared_ptr<EndEffectorTask> efTask_;
194 sva::ForceVecd wrench_;
196 sva::ForceVecd error_;
197 sva::ForceVecd errorD_;
199 unsigned int rIndex_;
202 double forceThresh_, torqueThresh_;
203 std::pair<double, double> forceGain_, torqueGain_;
204 Eigen::Matrix6d dof_;
205 std::function<double(
double)> clampTrans_, clampRot_;
#define MC_TASKS_DLLAPI
Definition: api.h:50
Definition: StabilizerStandingState.h:12
Definition: ForceSensor.h:20
Definition: QPSolver.h:86
Add a contact in a compliant manner.
Definition: ComplianceTask.h:25
ComplianceTask(const mc_rbdyn::Robots &robots, unsigned int robotIndex, const std::string &body, double timestep, const Eigen::Matrix6d &dof=Eigen::Matrix6d::Identity(), double stiffness=5.0, double weight=1000.0, double forceThresh=3., double torqueThresh=1., std::pair< double, double > forceGain=defaultFGain, std::pair< double, double > torqueGain=defaultTGain)
Constructor with dof restrictions.
void weight(double w)
Set the task weight.
Definition: ComplianceTask.h:136
void torqueThresh(double t)
Set the torque threshold.
Definition: ComplianceTask.h:150
Eigen::VectorXd eval() const override
Returns the task error.
Definition: ComplianceTask.h:183
void dof(const Eigen::Matrix6d &dof)
Set the current dof matrix.
Definition: ComplianceTask.h:165
double weight()
Get the task weight.
Definition: ComplianceTask.h:142
void setTargetWrench(const sva::ForceVecd &wrench)
Modify the target wrench.
Definition: ComplianceTask.h:121
double torqueThresh()
Get the torque threshold.
Definition: ComplianceTask.h:152
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const std::pair< double, double > defaultFGain
Definition: ComplianceTask.h:29
void stiffness(double s)
Set the task stiffness.
Definition: ComplianceTask.h:127
Eigen::Matrix6d dof()
Get the current dof matrix.
Definition: ComplianceTask.h:167
void torqueGain(std::pair< double, double > t)
Set the torque gain.
Definition: ComplianceTask.h:160
Eigen::VectorXd speed() const override
Returns the task velocity.
Definition: ComplianceTask.h:185
double forceThresh()
Get the force threshold.
Definition: ComplianceTask.h:147
ComplianceTask(const mc_rbdyn::Robots &robots, unsigned int robotIndex, const std::string &body, double timestep, double stiffness=5.0, double weight=1000.0, double forceThresh=3., double torqueThresh=1., std::pair< double, double > forceGain=defaultFGain, std::pair< double, double > torqueGain=defaultTGain)
Constructor.
void forceGain(std::pair< double, double > t)
Set the force gain.
Definition: ComplianceTask.h:155
sva::ForceVecd getFilteredWrench() const
Get the filtered wrench used by the task as a measure.
sva::ForceVecd getTargetWrench()
Get the current target wrench.
Definition: ComplianceTask.h:124
double stiffness()
Get the task stiffness.
Definition: ComplianceTask.h:133
std::pair< double, double > forceGain()
Get the force gain.
Definition: ComplianceTask.h:157
void selectUnactiveJoints(mc_solver::QPSolver &solver, const std::vector< std::string > &unactiveJointsName, const std::map< std::string, std::vector< std::array< int, 2 >>> &unactiveDofs={}) override
Setup an unactive joints selector.
void selectActiveJoints(mc_solver::QPSolver &solver, const std::vector< std::string > &activeJointsName, const std::map< std::string, std::vector< std::array< int, 2 >>> &activeDofs={}) override
Setup an active joints selector.
void resetJointsSelector(mc_solver::QPSolver &solver) override
Reset active joints selection.
static const std::pair< double, double > defaultTGain
Definition: ComplianceTask.h:30
Eigen::VectorXd dimWeight() const override
Get the current task's dim weight vector.
std::pair< double, double > torqueGain()
Get the torque gain.
Definition: ComplianceTask.h:162
void dimWeight(const Eigen::VectorXd &dimW) override
Set the task's dimension weight vector.
void reset() override
Reset the task.
void forceThresh(double t)
Set the force threshold.
Definition: ComplianceTask.h:145