chainjnttojacsolver_coupling.cpp
Go to the documentation of this file.
1 // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
2 
3 // Version: 1.0
4 // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
5 // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
6 // URL: http://www.orocos.org/kdl
7 
8 // Modified by Juan A. Corrales (ISIR, UPMC) in order to include coupling
9 
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 
25 
26 namespace KDL
27 {
29  chain(_chain), jac_tmp(chain.getNrOfJoints())
30  {
31  }
32 
34  {
35  }
36 
38  {
39  unsigned int jac_columns = chain.getNrOfIndJoints();
40 
41  if (q_in.rows() != chain.getNrOfJoints() || jac_columns != jac.columns())
42  {
43  return -1;
44  }
45 
48  int j = 0;
49  int k = 0;
50  Frame total;
51  for (unsigned int i = 0; i < chain.getNrOfSegments(); i++)
52  {
53  // Calculate new Frame_base_ee
55  {
56  // pose of the new end-point expressed in the base
57  total = T_tmp * chain.getSegment(i).pose(q_in(j));
58  // changing base of new segment's twist to base frame
59  // t_tmp = T_tmp.M*chain.getSegment(i).twist(1.0);
60  t_tmp = T_tmp.M * chain.getSegment(i).twist(q_in(j), 1.0);
61  }
62  else
63  {
64  total = T_tmp * chain.getSegment(i).pose(0.0);
65  }
66 
67  // Changing Refpoint of all columns to new ee
69 
70  // Only increase jointnr if the segment has a joint
72  {
73  jac_tmp.setColumn(k++, t_tmp);
74  j++;
75  }
76 
77  T_tmp = total;
78  }
79  jac.data.noalias() = jac_tmp.data * chain.cm;
80  return 0;
81  }
82 } // namespace KDL
83 
const Segment & getSegment(unsigned int nr) const
unsigned int rows() const
unsigned int getNrOfSegments() const
bool changeRefPoint(const Jacobian &src1, const Vector &base_AB, Jacobian &dest)
int JntToJac(const JntArray &q_in, Jacobian &jac)
unsigned int columns() const
Rotation M
Frame pose(const double &q) const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Matrix< double, 6, Eigen::Dynamic > data
Twist twist(const double &q, const double &qdot) const
unsigned int getNrOfIndJoints() const
Eigen::MatrixXd cm
const Joint & getJoint() const
void setColumn(unsigned int i, const Twist &t)
unsigned int getNrOfJoints() const
void SetToZero(Jacobian &jac)
static Frame Identity()
ChainJntToJacSolver_coupling(const Chain_coupling &chain)
const JointType & getType() const


kdl_coupling
Author(s): Juan Antonio Corrales Ramon (UPMC)
autogenerated on Wed Oct 14 2020 04:05:04