chainidsolver_vereshchagin.hpp
Go to the documentation of this file.
00001 // Copyright  (C)  2009, 2011
00002 
00003 // Version: 1.0
00004 // Author: Ruben Smits, Herman Bruyninckx, Azamat Shakhimardanov
00005 // Maintainer: Ruben Smits, Azamat Shakhimardanov
00006 // URL: http://www.orocos.org/kdl
00007 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Lesser General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2.1 of the License, or (at your option) any later version.
00012 
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Lesser General Public License for more details.
00017 
00018 // You should have received a copy of the GNU Lesser General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021 
00022 #ifndef KDL_CHAINIDSOLVER_VERESHCHAGIN_HPP
00023 #define KDL_CHAINIDSOLVER_VERESHCHAGIN_HPP
00024 
00025 #include "chainidsolver.hpp"
00026 #include "frames.hpp"
00027 #include "articulatedbodyinertia.hpp"
00028 
00029 #include<Eigen/StdVector>
00030 
00031 namespace KDL
00032 {
00040 class ChainIdSolver_Vereshchagin : KDL::SolverI
00041 {
00042     typedef std::vector<Twist> Twists;
00043     typedef std::vector<Frame> Frames;
00044     typedef Eigen::Matrix<double, 6, 1 > Vector6d;
00045     typedef Eigen::Matrix<double, 6, 6 > Matrix6d;
00046     typedef Eigen::Matrix<double, 6, Eigen::Dynamic> Matrix6Xd;
00047 
00048 public:
00055     ChainIdSolver_Vereshchagin(const Chain& chain, Twist root_acc, unsigned int nc);
00056 
00057     ~ChainIdSolver_Vereshchagin()
00058     {
00059     };
00060 
00074     int CartToJnt(const JntArray &q, const JntArray &q_dot, JntArray &q_dotdot, const Jacobian& alfa, const JntArray& beta, const Wrenches& f_ext, JntArray &torques);
00075 
00076     /*
00077     //Returns cartesian positions of links in base coordinates
00078     void getLinkCartesianPose(Frames& x_base);
00079     //Returns cartesian velocities of links in base coordinates
00080     void getLinkCartesianVelocity(Twists& xDot_base);
00081     //Returns cartesian acceleration of links in base coordinates
00082     void getLinkCartesianAcceleration(Twists& xDotDot_base);
00083     //Returns cartesian postions of links in link tip coordinates
00084     void getLinkPose(Frames& x_local);
00085     //Returns cartesian velocities of links in link tip coordinates
00086     void getLinkVelocity(Twists& xDot_local);
00087     //Returns cartesian acceleration of links in link tip coordinates
00088     void getLinkAcceleration(Twists& xDotdot_local);
00089     //Acceleration energy due to unit constraint forces at the end-effector
00090     void getLinkUnitForceAccelerationEnergy(Eigen::MatrixXd& M);
00091     //Acceleration energy due to arm configuration: bias force plus input joint torques
00092     void getLinkBiasForceAcceleratoinEnergy(Eigen::VectorXd& G);
00093 
00094     void getLinkUnitForceMatrix(Matrix6Xd& E_tilde);
00095 
00096     void getLinkBiasForceMatrix(Wrenches& R_tilde);
00097 
00098     void getJointBiasAcceleration(JntArray &bias_q_dotdot);
00099     */
00100 private:
00105     void initial_upwards_sweep(const JntArray &q, const JntArray &q_dot, const JntArray &q_dotdot, const Wrenches& f_ext);
00110     void downwards_sweep(const Jacobian& alfa, const JntArray& torques);
00115     void constraint_calculation(const JntArray& beta);
00120     void final_upwards_sweep(JntArray &q_dotdot, JntArray &torques);
00121 
00122 private:
00123     Chain chain;
00124     unsigned int nj;
00125     unsigned int ns;
00126     unsigned int nc;
00127     Twist acc_root;
00128     Jacobian alfa_N;
00129     Jacobian alfa_N2;
00130     Eigen::MatrixXd M_0_inverse;
00131     Eigen::MatrixXd Um;
00132     Eigen::MatrixXd Vm;
00133     JntArray beta_N;
00134     Eigen::VectorXd nu;
00135     Eigen::VectorXd nu_sum;
00136     Eigen::VectorXd Sm;
00137     Eigen::VectorXd tmpm;
00138     Wrench qdotdot_sum;
00139     Frame F_total;
00140 
00141     struct segment_info
00142     {
00143         Frame F; //local pose with respect to previous link in segments coordinates
00144         Frame F_base; // pose of a segment in root coordinates
00145         Twist Z; //Unit twist
00146         Twist v; //twist
00147         Twist acc; //acceleration twist
00148         Wrench U; //wrench p of the bias forces (in cartesian space)
00149         Wrench R; //wrench p of the bias forces
00150         Wrench R_tilde; //vector of wrench p of the bias forces (new) in matrix form
00151         Twist C; //constraint
00152         Twist A; //constraint
00153         ArticulatedBodyInertia H; //I (expressed in 6*6 matrix)
00154         ArticulatedBodyInertia P; //I (expressed in 6*6 matrix)
00155         ArticulatedBodyInertia P_tilde; //I (expressed in 6*6 matrix)
00156         Wrench PZ; //vector U[i] = I_A[i]*S[i]
00157         Wrench PC; //vector E[i] = I_A[i]*c[i]
00158         double D; //vector D[i] = S[i]^T*U[i]
00159         Matrix6Xd E; //matrix with virtual unit constraint force due to acceleration constraints
00160         Matrix6Xd E_tilde;
00161         Eigen::MatrixXd M; //acceleration energy already generated at link i
00162         Eigen::VectorXd G; //magnitude of the constraint forces already generated at link i
00163         Eigen::VectorXd EZ; //K[i] = Etiltde'*Z
00164         double nullspaceAccComp; //Azamat: constribution of joint space u[i] forces to joint space acceleration
00165         double constAccComp; //Azamat: constribution of joint space constraint forces to joint space acceleration
00166         double biasAccComp; //Azamat: constribution of joint space bias forces to joint space acceleration
00167         double totalBias; //Azamat: R+PC (centrepital+coriolis) in joint subspace
00168         double u; //vector u[i] = torques(i) - S[i]^T*(p_A[i] + I_A[i]*C[i]) in joint subspace. Azamat: In code u[i] = torques(i) - s[i].totalBias
00169 
00170         segment_info(unsigned int nc):
00171             D(0),nullspaceAccComp(0),constAccComp(0),biasAccComp(0),totalBias(0),u(0)
00172         {
00173             E.resize(6, nc);
00174             E_tilde.resize(6, nc);
00175             G.resize(nc);
00176             M.resize(nc, nc);
00177             EZ.resize(nc);
00178             E.setZero();
00179             E_tilde.setZero();
00180             M.setZero();
00181             G.setZero();
00182             EZ.setZero();
00183         };
00184     };
00185 
00186     std::vector<segment_info, Eigen::aligned_allocator<segment_info> > results;
00187 
00188 };
00189 }
00190 
00191 #endif


orocos_kdl
Author(s):
autogenerated on Sat Oct 7 2017 03:04:28