hrplib
hrpModel
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
;
92
int
numUpwardConnections
;
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
png_uint_32 size
Definition:
png.h:1518
hrp::LinkTraverse::end
std::vector< Link * >::const_iterator end() const
Definition:
LinkTraverse.h:68
config.h
hrp::LinkTraverse::totalMass
double totalMass() const
Definition:
LinkTraverse.h:85
hrp::LinkTraverse::empty
bool empty() const
Definition:
LinkTraverse.h:44
hrp::LinkTraverse::rootLink
Link * rootLink() const
Definition:
LinkTraverse.h:52
hrp::LinkTraverse::links
std::vector< Link * > links
Definition:
LinkTraverse.h:91
hrp::LinkTraverse::begin
std::vector< Link * >::const_iterator begin() const
Definition:
LinkTraverse.h:64
hrp::LinkTraverse::size
size_t size() const
Definition:
LinkTraverse.h:48
hrp
Definition:
ColdetModel.h:28
hrp::Link
Definition:
Link.h:40
Link
hrp::LinkTraverse::numLinks
unsigned int numLinks() const
Definition:
LinkTraverse.h:40
hrp::LinkTraverse::link
Link * link(int index) const
Definition:
LinkTraverse.h:56
operator<<
HRPMODEL_API std::ostream & operator<<(std::ostream &os, hrp::LinkTraverse &traverse)
Definition:
LinkTraverse.cpp:218
hrp::LinkTraverse
Definition:
LinkTraverse.h:29
hrp::LinkTraverse::isDownward
bool isDownward(int index) const
Definition:
LinkTraverse.h:77
hrp::LinkTraverse::numUpwardConnections
int numUpwardConnections
Definition:
LinkTraverse.h:92
hrp::LinkTraverse::totalMass_
double totalMass_
Definition:
LinkTraverse.h:93
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03