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
5ae11db6
Commit
5ae11db6
authored
Mar 14, 2019
by
Joseph Mirabel
Browse files
ProblemTarget stores a ProblemWkPtr_t to avoid memory leak.
parent
f2b9436c
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/hpp/core/problem-target.hh
View file @
5ae11db6
...
...
@@ -64,7 +64,7 @@ namespace hpp {
}
/// Reference to the planner for access to problem and roadmap
ProblemPtr_t
problem_
;
Problem
Wk
Ptr_t
problem_
;
/// Store weak pointer to itself
ProblemTargetWkPtr_t
weakPtr_
;
...
...
src/problem-target/goal-configurations.cc
View file @
5ae11db6
...
...
@@ -57,15 +57,17 @@ namespace hpp {
PathVectorPtr_t
GoalConfigurations
::
computePath
(
const
RoadmapPtr_t
&
roadmap
)
const
{
Astar
astar
(
roadmap
,
problem_
->
distance
());
ProblemPtr_t
problem
(
problem_
.
lock
());
assert
(
problem
);
Astar
astar
(
roadmap
,
problem
->
distance
());
PathVectorPtr_t
sol
=
PathVector
::
create
(
problem
_
->
robot
()
->
configSize
(),
problem
_
->
robot
()
->
numberDof
());
problem
->
robot
()
->
configSize
(),
problem
->
robot
()
->
numberDof
());
astar
.
solution
(
sol
);
// This happens when q_init == q_goal
if
(
sol
->
numberPaths
()
==
0
)
{
ConfigurationPtr_t
q
(
roadmap
->
initNode
()
->
configuration
());
sol
->
appendPath
(
(
*
problem
_
->
steeringMethod
())
(
*
q
,
*
q
)
(
*
problem
->
steeringMethod
())
(
*
q
,
*
q
)
);
}
return
sol
;
...
...
src/problem-target/task-target.cc
View file @
5ae11db6
...
...
@@ -54,15 +54,17 @@ namespace hpp {
PathVectorPtr_t
TaskTarget
::
computePath
(
const
RoadmapPtr_t
&
roadmap
)
const
{
Astar
astar
(
roadmap
,
problem_
->
distance
());
ProblemPtr_t
problem
(
problem_
.
lock
());
assert
(
problem
);
Astar
astar
(
roadmap
,
problem
->
distance
());
PathVectorPtr_t
sol
=
PathVector
::
create
(
problem
_
->
robot
()
->
configSize
(),
problem
_
->
robot
()
->
numberDof
());
problem
->
robot
()
->
configSize
(),
problem
->
robot
()
->
numberDof
());
astar
.
solution
(
sol
);
// This happens when q_init already satisfies the task.
if
(
sol
->
numberPaths
()
==
0
)
{
ConfigurationPtr_t
q
(
roadmap
->
initNode
()
->
configuration
());
sol
->
appendPath
(
(
*
problem
_
->
steeringMethod
())
(
*
q
,
*
q
)
(
*
problem
->
steeringMethod
())
(
*
q
,
*
q
)
);
}
return
sol
;
...
...
Write
Preview
Markdown
is supported
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