LinkTraverse.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  * General Robotix Inc.
9  */
10 
17 #ifndef HRPMODEL_LINK_TRAVERSE_H_INCLUDED
18 #define HRPMODEL_LINK_TRAVERSE_H_INCLUDED
19 
20 #include <vector>
21 #include <ostream>
22 #include <hrpUtil/config.h>
23 #include "Config.h"
24 
25 namespace hrp {
26 
27  class Link;
28 
29  class HRPMODEL_API LinkTraverse
30  {
31  public:
32  LinkTraverse();
33  LinkTraverse(int size);
34  LinkTraverse(Link* root, bool doUpward = false, bool doDownward = true);
35 
36  virtual ~LinkTraverse();
37 
38  virtual void find(Link* root, bool doUpward = false, bool doDownward = true);
39 
40  inline unsigned int numLinks() const {
41  return links.size();
42  }
43 
44  inline bool empty() const {
45  return links.empty();
46  }
47 
48  inline size_t size() const {
49  return links.size();
50  }
51 
52  inline Link* rootLink() const {
53  return (links.empty() ? 0 : links.front());
54  }
55 
56  inline Link* link(int index) const {
57  return links[index];
58  }
59 
60  inline Link* operator[] (int index) const {
61  return links[index];
62  }
63 
64  inline std::vector<Link*>::const_iterator begin() const {
65  return links.begin();
66  }
67 
68  inline std::vector<Link*>::const_iterator end() const {
69  return links.end();
70  }
71 
77  inline bool isDownward(int index) const {
78  return (index >= numUpwardConnections);
79  }
80 
81  void calcForwardKinematics(bool calcVelocity = false, bool calcAcceleration = false) const;
82 
83  double calcTotalMass();
84 
85  inline double totalMass() const {
86  return totalMass_;
87  }
88 
89  protected:
90 
91  std::vector<Link*> links;
93  double totalMass_;
94 
95  private:
96 
97  void traverse(Link* link, bool doUpward, bool doDownward, bool isUpward, Link* prev);
98 
99  };
100 
101 };
102 
103 HRPMODEL_API std::ostream& operator<<(std::ostream& os, hrp::LinkTraverse& traverse);
104 
105 #endif
size_t size() const
Definition: LinkTraverse.h:48
bool isDownward(int index) const
Definition: LinkTraverse.h:77
std::vector< Link * >::const_iterator end() const
Definition: LinkTraverse.h:68
png_uint_32 size
Definition: png.h:1521
std::vector< Link * >::const_iterator begin() const
Definition: LinkTraverse.h:64
Link * link(int index) const
Definition: LinkTraverse.h:56
HRPMODEL_API std::ostream & operator<<(std::ostream &os, hrp::LinkTraverse &traverse)
unsigned int numLinks() const
Definition: LinkTraverse.h:40
double totalMass() const
Definition: LinkTraverse.h:85
CORBA::Long find(const CorbaSequence &seq, Functor f)
bool empty() const
Definition: LinkTraverse.h:44
std::vector< Link * > links
Definition: LinkTraverse.h:91
Link * rootLink() const
Definition: LinkTraverse.h:52


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24