Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/pyhpp/manipulation/problem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <hpp/core/path-projector.hh>
#include <hpp/core/problem.hh>
#include <hpp/core/steering-method/straight.hh>
#include <hpp/manipulation/steering-method/end-effector-trajectory.hh>
#include <hpp/manipulation/steering-method/graph.hh>
#include <pyhpp/core/steering-method.hh>

Expand Down Expand Up @@ -64,6 +65,28 @@ void Problem::checkProblem() const { asManipulationProblem()->checkProblem(); }

void Problem::steeringMethod(
const pyhpp::core::PyWSteeringMethodPtr_t& steeringMethod) {
auto manipulationSteeringMethod = HPP_DYNAMIC_PTR_CAST(
hpp::manipulation::SteeringMethod, steeringMethod->obj);
auto endEffectorTrajectorySteeringMethod = HPP_DYNAMIC_PTR_CAST(
hpp::manipulation::steeringMethod::EndEffectorTrajectory,
steeringMethod->obj);
if (manipulationSteeringMethod || endEffectorTrajectorySteeringMethod) {
obj->steeringMethod(steeringMethod->obj);
return;
}

manipulationSteeringMethod = HPP_DYNAMIC_PTR_CAST(
hpp::manipulation::SteeringMethod, obj->steeringMethod());
if (!manipulationSteeringMethod) {
manipulationSteeringMethod =
hpp::manipulation::steeringMethod::Graph::create(obj);
obj->steeringMethod(manipulationSteeringMethod);
}
manipulationSteeringMethod->innerSteeringMethod(steeringMethod->obj);
}

void Problem::fullSteeringMethod(
const pyhpp::core::PyWSteeringMethodPtr_t& steeringMethod) {
obj->steeringMethod(steeringMethod->obj);
}

Expand Down Expand Up @@ -137,6 +160,7 @@ void exposeProblem() {
static_cast<void (Problem::*)(
const pyhpp::manipulation::PyWGraphSteeringMethodPtr_t&)>(
&Problem::graphSteeringMethod))
.def("fullSteeringMethod", &Problem::fullSteeringMethod)
// .PYHPP_DEFINE_GETTER_SETTER_CONST_REF(Problem, pathValidation,
// PathValidationPtr_t) .PYHPP_DEFINE_METHOD(Problem,
// manipulationSteeringMethod) .PYHPP_DEFINE_METHOD(Problem,
Expand Down
2 changes: 2 additions & 0 deletions src/pyhpp/manipulation/problem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct Problem : public pyhpp::core::Problem {
const pyhpp::core::PyWSteeringMethodPtr_t& steeringMethod);
pyhpp::core::PyWSteeringMethodPtr_t steeringMethod() const;
void graphSteeringMethod(const PyWGraphSteeringMethodPtr_t& steeringMethod);
void fullSteeringMethod(
const pyhpp::core::PyWSteeringMethodPtr_t& steeringMethod);
// PathValidationPtr_t pathValidation() const;
// void pathValidation (const PathValidationPtr_t &pathValidation);
// SteeringMethodPtr_t manipulationSteeringMethod() const;
Expand Down
24 changes: 12 additions & 12 deletions tests/integration/construction-set-m-rrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ def forbidExcept(g: str, h: T.List[str]) -> T.List[Rule]:
nodes.append(StateName(grasps))
rules.append(makeRule(grasps=grasps))

problem.steeringMethod = Straight(problem)
problem.pathValidation = Progressive(robot, 0.02)
problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.05
problem.steeringMethod(Straight(problem))
problem.pathValidation(Progressive(robot, 0.02))
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.05)
)

factory = ConstraintGraphFactory(cg, constraints)
Expand All @@ -429,8 +429,8 @@ def forbidExcept(g: str, h: T.List[str]) -> T.List[Rule]:

cg.initialize()

problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.05
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.05)
)

nodes.append(nodes[-1])
Expand All @@ -445,10 +445,10 @@ def forbidExcept(g: str, h: T.List[str]) -> T.List[Rule]:

rules.append(Rule(grippers=grippers, handles=[".*"] * len(grippers), link=True))

problem.steeringMethod = Straight(problem)
problem.pathValidation = Progressive(robot, 0.02)
problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.05
problem.steeringMethod(Straight(problem))
problem.pathValidation(Progressive(robot, 0.02))
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.05)
)

factory = ConstraintGraphFactory(cg, constraints)
Expand All @@ -468,8 +468,8 @@ def forbidExcept(g: str, h: T.List[str]) -> T.List[Rule]:

cg.initialize()

problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.05
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.05)
)

assert nCylinder == 2 and nSphere == 2
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/pr2-in-iai-kitchen.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
q_goal[rank] = -0.5

problem = Problem(robot)
problem.pathValidation = Dichotomy(robot, 0.0)
problem.steeringMethod = Straight(problem)
problem.pathValidation(Dichotomy(robot, 0.0))
problem.steeringMethod(Straight(problem))

problem.initConfig(q_init)
problem.addGoalConfig(q_goal)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/romeo-placard.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@
if not res:
raise RuntimeError("Failed to project goal configuration.")

problem.steeringMethod = Straight(problem)
problem.pathValidation = Dichotomy(robot, 0)
problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.05
problem.steeringMethod(Straight(problem))
problem.pathValidation(Dichotomy(robot, 0))
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.05)
)

problem.initConfig(q_init_proj)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/ur3-spheres-spf.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@
e, [constraints["place_sphere{}/complement".format(i)]]
)

problem.steeringMethod = Straight(problem)
problem.pathValidation = Dichotomy(robot, 0)
problem.steeringMethod(Straight(problem))
problem.pathValidation(Dichotomy(robot, 0))

# need to set path projector due to implicit constraints added above
problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.01
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.01)
)

cg.initialize()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/ur3-spheres.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@
e, [constraints["place_sphere{}/complement".format(i)]]
)

problem.steeringMethod = Straight(problem)
problem.pathValidation = Dichotomy(robot, 0)
problem.pathProjector = ProgressiveProjector(
problem.distance(), problem.steeringMethod, 0.01
problem.steeringMethod(Straight(problem))
problem.pathValidation(Dichotomy(robot, 0))
problem.pathProjector(
ProgressiveProjector(problem.distance(), problem.steeringMethod(), 0.01)
)

cg.initialize()
Expand Down