chain.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 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #include "chain.hpp"
23 
24 namespace KDL {
25  using namespace std;
26 
28  nrOfJoints(0),
29  nrOfSegments(0),
30  segments(0)
31  {
32  }
33 
34  Chain::Chain(const Chain& in):
35  nrOfJoints(0),
36  nrOfSegments(0),
37  segments(0)
38  {
39  for(unsigned int i=0;i<in.getNrOfSegments();i++)
40  this->addSegment(in.getSegment(i));
41  }
42 
44  {
45  nrOfJoints=0;
46  nrOfSegments=0;
47  segments.resize(0);
48  for(unsigned int i=0;i<arg.nrOfSegments;i++)
49  addSegment(arg.getSegment(i));
50  return *this;
51 
52  }
53 
54  void Chain::addSegment(const Segment& segment)
55  {
56  segments.push_back(segment);
57  nrOfSegments++;
58  if(segment.getJoint().getType()!=Joint::None)
59  nrOfJoints++;
60  }
61 
62  void Chain::addChain(const Chain& chain)
63  {
64  for(unsigned int i=0;i<chain.getNrOfSegments();i++)
65  this->addSegment(chain.getSegment(i));
66  }
67 
68  const Segment& Chain::getSegment(unsigned int nr)const
69  {
70  return segments[nr];
71  }
72 
73  Segment& Chain::getSegment(unsigned int nr)
74  {
75  return segments[nr];
76  }
77 
79  {
80  }
81 
82 }
83 
const Segment & getSegment(unsigned int nr) const
Definition: chain.cpp:68
This class encapsulates a simple segment, that is a "rigid body" (i.e., a frame and a rigid body...
Definition: segment.hpp:46
This class encapsulates a serial kinematic interconnection structure. It is built out of segments...
Definition: chain.hpp:35
unsigned int nrOfSegments
Definition: chain.hpp:38
unsigned int getNrOfSegments() const
Definition: chain.hpp:76
void addSegment(const Segment &segment)
Definition: chain.cpp:54
virtual ~Chain()
Definition: chain.cpp:78
const Joint & getJoint() const
Definition: segment.hpp:118
unsigned int nrOfJoints
Definition: chain.hpp:37
void addChain(const Chain &chain)
Definition: chain.cpp:62
std::vector< Segment > segments
Definition: chain.hpp:40
Chain & operator=(const Chain &arg)
Definition: chain.cpp:43
const JointType & getType() const
Definition: joint.hpp:159


orocos_kdl
Author(s):
autogenerated on Sat Jun 15 2019 19:07:36