30 #include <mc_rbdyn/Robot.h> 31 #include <mc_rtc/Configuration.h> 32 #include <mc_rtc/logging.h> 34 #include <SpaceVecAlg/SpaceVecAlg> 43 using HrepXd = std::pair<Eigen::MatrixXd, Eigen::VectorXd>;
60 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
74 Contact(
const sva::PTransformd & pose) : pose(pose) {}
81 return pose.rotation().row(0);
89 return pose.rotation().row(1);
97 return pose.rotation().row(2);
105 return pose.translation();
111 const Eigen::Vector3d &
p()
const 123 if(surfaceName ==
"LeftFootCenter")
127 else if(surfaceName ==
"RightFootCenter")
133 LOG_ERROR(
"Cannot compute anklePos for surface " << surfaceName);
145 return {pose.rotation(), anklePos(sole)};
153 return position()(0);
161 return position()(1);
169 return position()(2);
177 return position() + halfLength * sagittal() + halfWidth * lateral();
185 return position() + halfLength * sagittal() - halfWidth * lateral();
193 return position() - halfLength * sagittal() - halfWidth * lateral();
201 return position() - halfLength * sagittal() + halfWidth * lateral();
210 return std::min(std::min(vertex0()(i), vertex1()(i)), std::min(vertex2()(i), vertex3()(i)));
219 return std::max(std::max(vertex0()(i), vertex1()(i)), std::max(vertex2()(i), vertex3()(i)));
227 return minCoord<0>();
235 return maxCoord<0>();
243 return minCoord<1>();
251 return maxCoord<1>();
259 return minCoord<2>();
267 return maxCoord<2>();
275 Eigen::Matrix<double, 4, 2> localHrepMat, worldHrepMat;
276 Eigen::Matrix<double, 4, 1> localHrepVec, worldHrepVec;
291 LOG_WARNING(
"Contact is not horizontal");
293 const sva::PTransformd & X_0_c = pose;
294 worldHrepMat = localHrepMat * X_0_c.rotation().topLeftCorner<2, 2>();
295 worldHrepVec = worldHrepMat * X_0_c.translation().head<2>() + localHrepVec;
296 return HrepXd(worldHrepMat, worldHrepVec);
306 const sva::PTransformd & X_0_c = pose;
307 const sva::PTransformd & X_0_fb = robot.posW();
308 sva::PTransformd X_s_0 = robot.surfacePose(surfaceName).inv();
309 sva::PTransformd X_s_fb = X_0_fb * X_s_0;
310 return X_s_fb * X_0_c;
314 Eigen::Vector3d refVel =
315 Eigen::Vector3d::Zero();
316 double halfLength = 0.;
317 double halfWidth = 0.;
318 mc_rtc::Configuration
320 std::string surfaceName =
"";
348 contact.
pose = config(
"pose");
351 config(
"ref_vel", contact.
refVel);
353 if(config.has(
"swing"))
362 mc_rtc::Configuration config;
363 config.add(
"half_length", contact.
halfLength);
364 config.add(
"half_width", contact.
halfWidth);
365 config.add(
"pose", contact.
pose);
366 config.add(
"ref_vel", contact.
refVel);
ContactState
Contact state: set of feet in contact.
Framework namespace, only used to add a configuration loader.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector2d leftAnkleOffset
Offset from center to ankle frames in the left sole frame.
Contact operator*(const sva::PTransformd &X, const Contact &contact)
Apply Plucker transform to contact frame.
Main controller namespace.
std::pair< Eigen::MatrixXd, Eigen::VectorXd > HrepXd
const Eigen::Vector3d vertical