force_control_collection
WrenchDistribution.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <qp_solver_collection/QpSolverCollection.h>
4 
5 #include <ForceColl/Constants.h>
6 #include <ForceColl/Contact.h>
7 
8 namespace ForceColl
9 {
12 {
13 public:
16  {
18  sva::MotionVecd wrenchWeight = sva::MotionVecd(Eigen::Vector3d(1.0, 1.0, 1.0), Eigen::Vector3d(1.0, 1.0, 1.0));
19 
21  double regularWeight = 1e-8;
22 
24  std::pair<double, double> ridgeForceMinMax = std::make_pair(3, 1000); // [N]
25 
29  void load(const mc_rtc::Configuration & mcRtcConfig);
30  };
31 
32 public:
33  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34 
39  WrenchDistribution(const std::vector<std::shared_ptr<Contact>> & contactList,
40  const mc_rtc::Configuration & mcRtcConfig = {});
41 
47  sva::ForceVecd run(const sva::ForceVecd & desiredTotalWrench,
48  const Eigen::Vector3d & momentOrigin = Eigen::Vector3d::Zero());
49 
51  inline const Configuration & config() const noexcept
52  {
53  return config_;
54  }
55 
62  void addToGUI(mc_rtc::gui::StateBuilder & gui,
63  const std::vector<std::string> & category,
64  double forceScale = constants::defaultForceScale,
65  double fricPyramidScale = constants::defaultFricPyramidScale);
66 
67 public:
69  std::vector<std::shared_ptr<Contact>> contactList_;
70 
72  Eigen::VectorXd resultWrenchRatio_;
73 
75  sva::ForceVecd desiredTotalWrench_ = sva::ForceVecd::Zero();
76 
78  sva::ForceVecd resultTotalWrench_ = sva::ForceVecd::Zero();
79 
81  std::shared_ptr<QpSolverCollection::QpSolver> qpSolver_;
82 
84  QpSolverCollection::QpCoeff qpCoeff_;
85 
86 protected:
89 };
90 } // namespace ForceColl
ForceColl::WrenchDistribution::Configuration::ridgeForceMinMax
std::pair< double, double > ridgeForceMinMax
Min/max ridge force.
Definition: WrenchDistribution.h:24
ForceColl::WrenchDistribution::resultTotalWrench_
sva::ForceVecd resultTotalWrench_
Result total wrench.
Definition: WrenchDistribution.h:78
ForceColl::constants::defaultForceScale
constexpr double defaultForceScale
Default scale of force markers.
Definition: Constants.h:8
ForceColl::WrenchDistribution::run
sva::ForceVecd run(const sva::ForceVecd &desiredTotalWrench, const Eigen::Vector3d &momentOrigin=Eigen::Vector3d::Zero())
Run wrench distribution calculation.
ForceColl::WrenchDistribution
Wrench distribution.
Definition: WrenchDistribution.h:11
ForceColl::WrenchDistribution::Configuration::load
void load(const mc_rtc::Configuration &mcRtcConfig)
Load mc_rtc configuration.
ForceColl::WrenchDistribution::config
const Configuration & config() const noexcept
Const accessor to the configuration.
Definition: WrenchDistribution.h:51
ForceColl::WrenchDistribution::Configuration
Configuration.
Definition: WrenchDistribution.h:15
ForceColl::WrenchDistribution::config_
Configuration config_
Configuration.
Definition: WrenchDistribution.h:88
Constants.h
ForceColl::WrenchDistribution::Configuration::regularWeight
double regularWeight
Weight of QP regularization.
Definition: WrenchDistribution.h:21
ForceColl::WrenchDistribution::contactList_
std::vector< std::shared_ptr< Contact > > contactList_
List of contact constraint.
Definition: WrenchDistribution.h:69
ForceColl::WrenchDistribution::resultWrenchRatio_
Eigen::VectorXd resultWrenchRatio_
Result wrench ratio.
Definition: WrenchDistribution.h:72
ForceColl::WrenchDistribution::WrenchDistribution
EIGEN_MAKE_ALIGNED_OPERATOR_NEW WrenchDistribution(const std::vector< std::shared_ptr< Contact >> &contactList, const mc_rtc::Configuration &mcRtcConfig={})
Constructor.
ForceColl::WrenchDistribution::qpSolver_
std::shared_ptr< QpSolverCollection::QpSolver > qpSolver_
QP solver.
Definition: WrenchDistribution.h:81
ForceColl::WrenchDistribution::desiredTotalWrench_
sva::ForceVecd desiredTotalWrench_
Desired total wrench.
Definition: WrenchDistribution.h:75
ForceColl
Definition: Constants.h:3
ForceColl::WrenchDistribution::qpCoeff_
QpSolverCollection::QpCoeff qpCoeff_
QP coefficients.
Definition: WrenchDistribution.h:84
ForceColl::WrenchDistribution::Configuration::wrenchWeight
sva::MotionVecd wrenchWeight
Wrench distribution weight.
Definition: WrenchDistribution.h:18
ForceColl::WrenchDistribution::addToGUI
void addToGUI(mc_rtc::gui::StateBuilder &gui, const std::vector< std::string > &category, double forceScale=constants::defaultForceScale, double fricPyramidScale=constants::defaultFricPyramidScale)
Add markers to GUI.
Contact.h
ForceColl::constants::defaultFricPyramidScale
constexpr double defaultFricPyramidScale
Default scale of friction pyramid markers.
Definition: Constants.h:11