Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Humanoid Path Planner
hpp-core
Commits
637680b9
Commit
637680b9
authored
Dec 13, 2012
by
Antonio El Khoury
Browse files
Add method to write a path in a kxml file.
parent
a6b91650
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/hpp/core/planner.hh
View file @
637680b9
...
...
@@ -272,6 +272,17 @@ namespace hpp {
/// \brief Load a path from file.
ktStatus
loadPathFromFile
(
const
std
::
string
&
fileName
);
/// \brief Write path to file.
///
/// \param rank rank of problem
/// \param pathId id of path in problem
/// \param pathName name to be given to the path component
/// \param fileName file path where the component will be saved.
ktStatus
writePathToFile
(
unsigned
int
rank
,
unsigned
int
pathId
,
const
std
::
string
&
pathName
,
const
std
::
string
&
fileName
);
/// @}
/// \name Initialization
...
...
src/planner.cc
View file @
637680b9
...
...
@@ -911,5 +911,44 @@ namespace hpp {
return
KD_OK
;
}
ktStatus
Planner
::
writePathToFile
(
unsigned
int
rank
,
unsigned
int
pathId
,
const
std
::
string
&
pathName
,
const
std
::
string
&
fileName
)
{
// Attach device to a fictitious model tree to avoid saving the
// whole device in the path. This way only its reference is
// saved.
CkppModelTreeShPtr
modelTree
=
CkppModelTree
::
create
();
modelTree
->
deviceNode
()
->
addChildComponent
(
robotIthProblem
(
rank
));
CkwsPathShPtr
path
=
getPath
(
rank
,
pathId
);
if
(
!
path
)
{
hppDout
(
error
,
"Could not get path at rank "
<<
rank
<<
" and id "
<<
pathId
<<
"."
);
return
KD_ERROR
;
}
CkppPathComponentShPtr
pathComponent
=
CkppPathComponent
::
create
(
path
,
pathName
);
if
(
!
pathComponent
)
{
hppDout
(
error
,
"Could not create path component from path."
);
return
KD_ERROR
;
}
// Write path to file.
if
(
KD_OK
!=
CkprParserManager
::
defaultManager
()
->
writeComponentToFile
(
fileName
,
pathComponent
))
{
hppDout
(
error
,
"Could not write path to file."
);
return
KD_ERROR
;
}
return
KD_OK
;
}
}
// namespace core
}
// namespace namespace hpp
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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