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
181c4fc0
Verified
Commit
181c4fc0
authored
Mar 11, 2020
by
Justin Carpentier
Browse files
core/model: fix addFrame to handle existing Frame
parent
edf6529e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/multibody/model.hpp
View file @
181c4fc0
...
...
@@ -509,8 +509,8 @@ namespace pinocchio
///
/// \param[in] frame The frame to add to the kinematic tree.
///
/// \return Returns the index of the frame if it has been successfully added
,
///
-1 otherwis
e.
/// \return Returns the index of the frame if it has been successfully added
or if it already exists in the kinematic tree.
///
The function returns -1 when the frame.type did not match with the existing frame in the kinematic having the same nam
e.
///
int
addFrame
(
const
Frame
&
frame
);
...
...
src/multibody/model.hxx
View file @
181c4fc0
...
...
@@ -251,16 +251,21 @@ namespace pinocchio
inline
int
ModelTpl
<
Scalar
,
Options
,
JointCollectionTpl
>::
addFrame
(
const
Frame
&
frame
)
{
if
(
!
existFrame
(
frame
.
name
,
frame
.
type
))
// Check if the frame.name exists
if
(
existFrame
(
frame
.
name
))
{
FrameIndex
frame_id
=
getFrameId
(
frame
.
name
);
if
(
frames
[
frame_id
].
type
==
frame
.
type
)
return
frame_id
;
else
return
-
1
;
}
else
// does not exist, so add the Frame to the kinematic tree
{
frames
.
push_back
(
frame
);
nframes
++
;
return
nframes
-
1
;
}
else
{
return
-
1
;
}
}
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