Blender V4.3
chain.cpp
Go to the documentation of this file.
1
4// Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
5
6// Version: 1.0
7// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
8// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
9// URL: http://www.orocos.org/kdl
10
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25#include "chain.hpp"
26
27namespace KDL {
28 using namespace std;
29
31 segments(0),
32 nrOfJoints(0),
33 nrOfSegments(0)
34 {
35 }
36
37 Chain::Chain(const Chain& in):nrOfJoints(0),
38 nrOfSegments(0)
39 {
40 for(unsigned int i=0;i<in.getNrOfSegments();i++)
41 this->addSegment(in.getSegment(i));
42 }
43
45 {
46 nrOfJoints=0;
47 nrOfSegments=0;
48 segments.resize(0);
49 for(unsigned int i=0;i<arg.nrOfSegments;i++)
50 addSegment(arg.getSegment(i));
51 return *this;
52
53 }
54
55 void Chain::addSegment(const Segment& segment)
56 {
57 segments.push_back(segment);
58 nrOfSegments++;
59 nrOfJoints += segment.getJoint().getNDof();
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
74 {
75 }
76
77}
78
This class encapsulates a serial kinematic interconnection structure. It is build out of segments.
Definition chain.hpp:36
void addChain(const Chain &chain)
Definition chain.cpp:62
const Segment & getSegment(unsigned int nr) const
Definition chain.cpp:68
virtual ~Chain()
Definition chain.cpp:73
Chain & operator=(const Chain &arg)
Definition chain.cpp:44
void addSegment(const Segment &segment)
Definition chain.cpp:55
unsigned int getNrOfSegments() const
Definition chain.hpp:78
This class encapsulates a simple segment, that is a "rigid body" (i.e., a frame and an inertia) with ...
Definition segment.hpp:46
Definition chain.cpp:27