1#ifndef ROBOTOC_SURFACE_CONTACT_HXX_
2#define ROBOTOC_SURFACE_CONTACT_HXX_
6#include "pinocchio/algorithm/joint-configuration.hpp"
7#include "pinocchio/algorithm/frames.hpp"
8#include "pinocchio/algorithm/kinematics-derivatives.hpp"
9#include "pinocchio/algorithm/frames-derivatives.hpp"
16template <
typename VectorType>
18 const pinocchio::Model& model,
const pinocchio::Data& data,
19 const SE3& desired_contact_placement,
20 const Eigen::MatrixBase<VectorType>& baumgarte_residual) {
21 assert(baumgarte_residual.size() == 6);
22 const_cast<Eigen::MatrixBase<VectorType>&
> (baumgarte_residual).noalias()
23 = pinocchio::getFrameAcceleration(model, data, contact_frame_id_,
24 pinocchio::LOCAL).toVector();
25 (
const_cast<Eigen::MatrixBase<VectorType>&
> (baumgarte_residual)).noalias()
27 * pinocchio::getFrameVelocity(model, data, contact_frame_id_,
28 pinocchio::LOCAL).toVector();
29 X_diff_ = desired_contact_placement.inverse() * data.oMf[contact_frame_id_];
30 (
const_cast<Eigen::MatrixBase<VectorType>&
> (baumgarte_residual)).noalias()
35template <
typename MatrixType1,
typename MatrixType2,
typename MatrixType3>
37 const pinocchio::Model& model, pinocchio::Data& data,
38 const Eigen::MatrixBase<MatrixType1>& baumgarte_partial_dq,
39 const Eigen::MatrixBase<MatrixType2>& baumgarte_partial_dv,
40 const Eigen::MatrixBase<MatrixType3>& baumgarte_partial_da) {
41 assert(baumgarte_partial_dq.cols() == dimv_);
42 assert(baumgarte_partial_dv.cols() == dimv_);
43 assert(baumgarte_partial_da.cols() == dimv_);
44 assert(baumgarte_partial_dq.rows() == 6);
45 assert(baumgarte_partial_dv.rows() == 6);
46 assert(baumgarte_partial_da.rows() == 6);
47 pinocchio::getFrameAccelerationDerivatives(model, data, contact_frame_id_,
56 pinocchio::getFrameJacobian(model, data, contact_frame_id_,
57 pinocchio::LOCAL, J_frame_);
58 const_cast<Eigen::MatrixBase<MatrixType1>&
> (baumgarte_partial_dq)
59 = frame_a_partial_dq_;
60 const_cast<Eigen::MatrixBase<MatrixType1>&
> (baumgarte_partial_dv)
61 = frame_a_partial_dv_;
62 const_cast<Eigen::MatrixBase<MatrixType3>&
> (baumgarte_partial_da)
63 = frame_a_partial_da_;
64 (
const_cast<Eigen::MatrixBase<MatrixType1>&
> (baumgarte_partial_dq)).noalias()
66 (
const_cast<Eigen::MatrixBase<MatrixType2>&
> (baumgarte_partial_dv)).noalias()
69 (
const_cast<Eigen::MatrixBase<MatrixType1>&
> (baumgarte_partial_dq)).noalias()
74template <
typename VectorType>
76 const pinocchio::Model& model,
const pinocchio::Data& data,
77 const Eigen::MatrixBase<VectorType>& velocity_residual)
const {
78 assert(velocity_residual.size() == 6);
79 const_cast<Eigen::MatrixBase<VectorType>&
> (velocity_residual).noalias()
80 = pinocchio::getFrameVelocity(model, data, contact_frame_id_,
81 pinocchio::LOCAL).toVector();
85template <
typename MatrixType1,
typename MatrixType2>
87 const pinocchio::Model& model, pinocchio::Data& data,
88 const Eigen::MatrixBase<MatrixType1>& velocity_partial_dq,
89 const Eigen::MatrixBase<MatrixType2>& velocity_partial_dv) {
90 assert(velocity_partial_dq.cols() == dimv_);
91 assert(velocity_partial_dv.cols() == dimv_);
92 assert(velocity_partial_dq.rows() == 6);
93 assert(velocity_partial_dv.rows() == 6);
94 pinocchio::getFrameVelocityDerivatives(model, data, contact_frame_id_,
98 (
const_cast<Eigen::MatrixBase<MatrixType1>&
> (velocity_partial_dq)).noalias()
99 = frame_v_partial_dq_;
100 (
const_cast<Eigen::MatrixBase<MatrixType2>&
> (velocity_partial_dv)).noalias()
101 = frame_a_partial_da_;
105template <
typename VectorType>
107 const pinocchio::Model& model,
const pinocchio::Data& data,
108 const SE3& desired_contact_placement,
109 const Eigen::MatrixBase<VectorType>& position_residual) {
110 assert(position_residual.size() == 6);
111 X_diff_ = desired_contact_placement.inverse() * data.oMf[contact_frame_id_];
112 (
const_cast<Eigen::MatrixBase<VectorType>&
> (position_residual))
117template <
typename MatrixType>
119 const pinocchio::Model& model, pinocchio::Data& data,
120 const Eigen::MatrixBase<MatrixType>& position_partial_dq) {
121 assert(position_partial_dq.cols() == dimv_);
122 assert(position_partial_dq.rows() == 6);
123 pinocchio::getFrameJacobian(model, data, contact_frame_id_,
124 pinocchio::LOCAL, J_frame_);
126 (
const_cast<Eigen::MatrixBase<MatrixType>&
> (position_partial_dq)).noalias()
Definition: constraint_component_base.hpp:17
void computeJLog6Map(const SE3Type &SE3_obj, const Eigen::MatrixBase< MatrixType > &J)
Computes the Jacobian of the Log6 map.
Definition: se3.hpp:33
const Eigen::Matrix< double, 6, 1 > Log6Map(const SE3Type &SE3_obj)
Applies Log6 map that transforms the SE3 into 6-dimensional vector.
Definition: se3.hpp:23
pinocchio::SE3 SE3
Using pinocchio::SE3 without its namespace.
Definition: se3.hpp:15