Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
pinocchio
Commits
c8b0e3f4
Verified
Commit
c8b0e3f4
authored
Nov 03, 2019
by
Justin Carpentier
Browse files
model: minor clean of the code and doc
parent
089f46b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/multibody/model.hpp
View file @
c8b0e3f4
...
...
@@ -272,32 +272,32 @@ namespace pinocchio
return
false
;
res
&=
other
.
referenceConfigurations
==
referenceConfigurations
;
if
(
!
res
)
return
res
;
if
(
other
.
rotorInertia
.
size
()
!=
rotorInertia
.
size
())
return
false
;
res
&=
other
.
rotorInertia
==
rotorInertia
;
if
(
!
res
)
return
res
;
if
(
other
.
rotorGearRatio
.
size
()
!=
rotorGearRatio
.
size
())
return
false
;
res
&=
other
.
rotorGearRatio
==
rotorGearRatio
;
if
(
!
res
)
return
res
;
if
(
other
.
effortLimit
.
size
()
!=
effortLimit
.
size
())
return
false
;
res
&=
other
.
effortLimit
==
effortLimit
;
if
(
!
res
)
return
res
;
if
(
other
.
velocityLimit
.
size
()
!=
velocityLimit
.
size
())
return
false
;
res
&=
other
.
velocityLimit
==
velocityLimit
;
if
(
!
res
)
return
res
;
if
(
other
.
lowerPositionLimit
.
size
()
!=
lowerPositionLimit
.
size
())
return
false
;
res
&=
other
.
lowerPositionLimit
==
lowerPositionLimit
;
if
(
!
res
)
return
res
;
if
(
other
.
upperPositionLimit
.
size
()
!=
upperPositionLimit
.
size
())
return
false
;
res
&=
other
.
upperPositionLimit
==
upperPositionLimit
;
...
...
@@ -322,7 +322,7 @@ namespace pinocchio
return
res
;
}
//
//
/
/// \returns true if *this is NOT equal to other.
///
bool
operator
!=
(
const
ModelTpl
&
other
)
const
...
...
@@ -391,8 +391,8 @@ namespace pinocchio
///
/// \return The index of the new frame or -1 in case of error.
///
int
addJointFrame
(
const
JointIndex
&
joint
I
ndex
,
int
frame
I
ndex
=
-
1
);
int
addJointFrame
(
const
JointIndex
&
joint
_i
ndex
,
int
previous_
frame
_i
ndex
=
-
1
);
///
/// \brief Append a body to a given joint of the kinematic tree.
...
...
@@ -424,11 +424,11 @@ namespace pinocchio
///
/// \brief Return the index of a body given by its name.
///
///
/// \warning If no body is found, return the number of elements at time T.
/// This can lead to errors if the model is expanded after this method is called
/// (for example to get the id of a parent body)
///
///
/// \param[in] name Name of the body.
///
/// \return Index of the body.
...
...
@@ -483,7 +483,7 @@ namespace pinocchio
/// \warning If no frame is found, returns the size of the vector of Model::frames.
/// This can lead to errors if the model is expanded after this method is called
/// (for example to get the id of a parent frame).
///
///
/// \param[in] name Name of the frame.
/// \param[in] type Type of the frame.
///
...
...
@@ -503,7 +503,6 @@ namespace pinocchio
bool
existFrame
(
const
std
::
string
&
name
,
const
FrameType
&
type
=
(
FrameType
)
(
JOINT
|
FIXED_JOINT
|
BODY
|
OP_FRAME
|
SENSOR
))
const
;
///
/// \brief Adds a frame to the kinematic tree.
///
...
...
@@ -514,13 +513,16 @@ namespace pinocchio
///
int
addFrame
(
const
Frame
&
frame
);
///
/// \brief Check the validity of the attributes of Model with respect to the specification of some
/// algorithms.
///
/// The method is a template so that the checkers can be defined in each algorithms.
/// \param[in] checker a class, typically defined in the algorithm module, that
/// validates the attributes of model.
///
/// \return true if the Model is valid, false otherwise.
///
template
<
typename
D
>
inline
bool
check
(
const
AlgorithmCheckerBase
<
D
>
&
checker
=
AlgorithmCheckerBase
<
D
>
())
const
{
return
checker
.
checkModel
(
*
this
);
}
...
...
@@ -528,15 +530,18 @@ namespace pinocchio
/// Run check(fusion::list) with DEFAULT_CHECKERS as argument.
inline
bool
check
()
const
;
///
/// \brief Run checkData on data and current model.
///
/// \param[in] data to be checked wrt *this.
///
/// \return true if the data is valid, false otherwise.
///
inline
bool
check
(
const
Data
&
data
)
const
;
protected:
///
/// \brief Add the joint_id to its parent subtrees.
///
/// \param[in] joint_id The id of the joint to add to the subtrees
...
...
src/multibody/model.hxx
View file @
c8b0e3f4
...
...
@@ -147,17 +147,21 @@ namespace pinocchio
template
<
typename
Scalar
,
int
Options
,
template
<
typename
,
int
>
class
JointCollectionTpl
>
inline
int
ModelTpl
<
Scalar
,
Options
,
JointCollectionTpl
>::
addJointFrame
(
const
JointIndex
&
j
id
x
,
int
fid
x
)
addJointFrame
(
const
JointIndex
&
j
oint_inde
x
,
int
previous_frame_inde
x
)
{
if
(
fidx
<
0
)
{
PINOCCHIO_CHECK_INPUT_ARGUMENT
(
joint_index
>=
0
&&
joint_index
<
joints
.
size
(),
"The joint index is larger than the number of joints in the model."
);
if
(
previous_frame_index
<
0
)
{
// FIXED_JOINT is required because the parent can be the universe and its
// type is FIXED_JOINT
fid
x
=
(
int
)
getFrameId
(
names
[
parents
[
j
id
x
]],
(
FrameType
)(
JOINT
|
FIXED_JOINT
));
previous_frame_inde
x
=
(
int
)
getFrameId
(
names
[
parents
[
j
oint_inde
x
]],
(
FrameType
)(
JOINT
|
FIXED_JOINT
));
}
assert
((
size_t
)
fidx
<
frames
.
size
()
&&
"Frame index out of bound"
);
assert
((
size_t
)
previous_frame_index
<
frames
.
size
()
&&
"Frame index out of bound"
);
// Add a the joint frame attached to itself to the frame vector - redundant information but useful.
return
addFrame
(
Frame
(
names
[
j
idx
],
jidx
,(
FrameIndex
)
fid
x
,
SE3
::
Identity
(),
JOINT
));
return
addFrame
(
Frame
(
names
[
j
oint_index
],
joint_index
,(
FrameIndex
)
previous_frame_inde
x
,
SE3
::
Identity
(),
JOINT
));
}
template
<
typename
Scalar
,
int
Options
,
template
<
typename
,
int
>
class
JointCollectionTpl
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment