PositionBasedVisServoFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_tvm/api.h>
8 #include <mc_tvm/fwd.h>
9 
10 #include <mc_rbdyn/fwd.h>
11 
12 #include <tvm/function/abstract/Function.h>
13 
14 #include <RBDyn/Jacobian.h>
15 
16 namespace mc_tvm
17 {
18 
26 struct MC_TVM_DLLAPI PositionBasedVisServoFunction : tvm::function::abstract::Function
27 {
28  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 
30  SET_UPDATES(PositionBasedVisServoFunction, Value, Velocity, Jacobian, NormalAcceleration)
31 
32 
37 
39  inline void reset() noexcept { X_t_s_ = sva::PTransformd::Identity(); }
40 
42  inline const sva::PTransformd & error() const noexcept { return X_t_s_; }
43 
45  inline void error(const sva::PTransformd & X_t_s) noexcept { X_t_s_ = X_t_s; }
46 
48  inline const mc_rbdyn::RobotFrame & frame() const noexcept { return *frame_; }
49 
50 protected:
53 
54  /* Inputs to the function */
55  sva::PTransformd X_t_s_;
56 
57  /* Computation intermediates */
58  rbd::Jacobian frameJac_;
59  double angle_;
60  Eigen::Vector3d axis_;
61  Eigen::Matrix<double, 6, 6> L_pbvs_;
62  Eigen::Matrix<double, 6, 1> frameVelocity_;
63  Eigen::Matrix3d omegaSkew_;
64  Eigen::Matrix<double, 6, 6> L_pbvs_dot_;
65 
66  /* TVM update methods */
67  void updateValue();
68  void updateVelocity();
69  void updateJacobian();
70  Eigen::MatrixXd shortJacMat_;
71  Eigen::MatrixXd jacMat_;
72  void updateNormalAcceleration();
73 };
74 
75 } // namespace mc_tvm
mc_tvm::PositionBasedVisServoFunction::frameVelocity_
Eigen::Matrix< double, 6, 1 > frameVelocity_
Definition: PositionBasedVisServoFunction.h:62
mc_tvm::PositionBasedVisServoFunction::frameJac_
rbd::Jacobian frameJac_
Definition: PositionBasedVisServoFunction.h:58
mc_tvm::PositionBasedVisServoFunction::error
const sva::PTransformd & error() const noexcept
Definition: PositionBasedVisServoFunction.h:42
mc_tvm::PositionBasedVisServoFunction::error
void error(const sva::PTransformd &X_t_s) noexcept
Definition: PositionBasedVisServoFunction.h:45
MC_TVM_DLLAPI
#define MC_TVM_DLLAPI
Definition: api.h:47
mc_tvm::PositionBasedVisServoFunction
Definition: PositionBasedVisServoFunction.h:26
mc_tvm
Definition: CollisionFunction.h:15
mc_tvm::PositionBasedVisServoFunction::shortJacMat_
Eigen::MatrixXd shortJacMat_
Definition: PositionBasedVisServoFunction.h:70
mc_rbdyn::RobotFrame
Definition: RobotFrame.h:21
mc_tvm::PositionBasedVisServoFunction::axis_
Eigen::Vector3d axis_
Definition: PositionBasedVisServoFunction.h:60
mc_tvm::PositionBasedVisServoFunction::reset
void reset() noexcept
Definition: PositionBasedVisServoFunction.h:39
fwd.h
fwd.h
mc_rbdyn::ConstRobotFramePtr
std::shared_ptr< const RobotFrame > ConstRobotFramePtr
Definition: fwd.h:25
mc_tvm::RobotFrame
Definition: RobotFrame.h:27
mc_tvm::PositionBasedVisServoFunction::L_pbvs_dot_
Eigen::Matrix< double, 6, 6 > L_pbvs_dot_
Definition: PositionBasedVisServoFunction.h:64
mc_tvm::PositionBasedVisServoFunction::X_t_s_
sva::PTransformd X_t_s_
Definition: PositionBasedVisServoFunction.h:55
mc_tvm::PositionBasedVisServoFunction::frame
const mc_rbdyn::RobotFrame & frame() const noexcept
Definition: PositionBasedVisServoFunction.h:48
mc_tvm::PositionBasedVisServoFunction::tvm_frame_
mc_tvm::RobotFrame & tvm_frame_
Definition: PositionBasedVisServoFunction.h:52
mc_tvm::PositionBasedVisServoFunction::frame_
mc_rbdyn::ConstRobotFramePtr frame_
Definition: PositionBasedVisServoFunction.h:51
mc_tvm::PositionBasedVisServoFunction::jacMat_
Eigen::MatrixXd jacMat_
Definition: PositionBasedVisServoFunction.h:71
api.h
mc_tvm::PositionBasedVisServoFunction::angle_
double angle_
Definition: PositionBasedVisServoFunction.h:59
mc_tvm::PositionBasedVisServoFunction::L_pbvs_
Eigen::Matrix< double, 6, 6 > L_pbvs_
Definition: PositionBasedVisServoFunction.h:61
mc_tvm::PositionBasedVisServoFunction::omegaSkew_
Eigen::Matrix3d omegaSkew_
Definition: PositionBasedVisServoFunction.h:63