Skip to content

Commit ee7cec2

Browse files
committed
FixedState: ignore_collisions=false
Check collisions for FixedState's scene and report failure if needed. Optionally, disable the check via the property ignore_collisions=true.
1 parent ca38d11 commit ee7cec2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/stages/fixed_state.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace stages {
4545

4646
FixedState::FixedState(const std::string& name, planning_scene::PlanningScenePtr scene)
4747
: Generator(name), scene_(scene) {
48+
properties().declare("ignore_collisions", false);
4849
setCostTerm(std::make_unique<cost::Constant>(0.0));
4950
}
5051

@@ -62,7 +63,10 @@ bool FixedState::canCompute() const {
6263
}
6364

6465
void FixedState::compute() {
65-
spawn(InterfaceState(scene_), 0.0);
66+
auto cost = !properties().get<bool>("ignore_collisions") && scene_->isStateColliding() ?
67+
std::numeric_limits<double>::infinity() :
68+
0.0;
69+
spawn(InterfaceState(scene_), cost);
6670
ran_ = true;
6771
}
6872
} // namespace stages

0 commit comments

Comments
 (0)