39#include <ompl/base/spaces/constraint/ConstrainedStateSpace.h>
40#include <rclcpp/logger.hpp>
41#include <rclcpp/logging.hpp>
58 ,
tss_(pc->getCompleteInitialRobotState())
61 specs_.clearanceComputationType = ompl::base::StateValidityCheckerSpecs::APPROXIMATE;
62 specs_.hasValidDirectionComputation =
false;
85 assert(state !=
nullptr);
92 if (!si_->satisfiesBounds(state))
96 RCLCPP_INFO(
getLogger(),
"State outside bounds");
98 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
106 const kinematic_constraints::KinematicConstraintSetPtr& kset =
planning_context_->getPathConstraints();
107 if (kset && !kset->decide(*robot_state, verbose).satisfied)
109 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
114 if (!
planning_context_->getPlanningScene()->isStateFeasible(*robot_state, verbose))
116 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
126 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markValid();
130 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
137 assert(state !=
nullptr);
146 if (!si_->satisfiesBounds(state))
150 RCLCPP_INFO(
getLogger(),
"State outside bounds");
152 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid(0.0);
160 const kinematic_constraints::KinematicConstraintSetPtr& kset =
planning_context_->getPathConstraints();
167 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid(dist);
173 if (!
planning_context_->getPlanningScene()->isStateFeasible(*robot_state, verbose))
189 assert(state !=
nullptr);
209 assert(state !=
nullptr);
223 assert(wrapped_state !=
nullptr);
225 auto state = wrapped_state->as<ompl::base::ConstrainedStateSpace::StateType>()->
getState();
234 if (!si_->satisfiesBounds(wrapped_state))
236 RCLCPP_DEBUG(
getLogger(),
"State outside bounds");
237 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
243 planning_context_->getOMPLStateSpace()->copyToRobotState(*robot_state, wrapped_state);
246 const kinematic_constraints::KinematicConstraintSetPtr& kset =
planning_context_->getPathConstraints();
247 if (kset && !kset->decide(*robot_state, verbose).satisfied)
249 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
254 if (!
planning_context_->getPlanningScene()->isStateFeasible(*robot_state, verbose))
256 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
266 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markValid();
270 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
278 assert(wrapped_state !=
nullptr);
280 auto state = wrapped_state->as<ompl::base::ConstrainedStateSpace::StateType>()->
getState();
291 if (!si_->satisfiesBounds(wrapped_state))
293 RCLCPP_DEBUG(
getLogger(),
"State outside bounds");
294 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid(0.0);
301 planning_context_->getOMPLStateSpace()->copyToRobotState(*robot_state, wrapped_state);
304 const kinematic_constraints::KinematicConstraintSetPtr& kset =
planning_context_->getPathConstraints();
305 if (kset && !kset->decide(*robot_state, verbose).satisfied)
307 const_cast<ob::State*
>(state)->as<ModelBasedStateSpace::StateType>()->markInvalid();
312 if (!
planning_context_->getPlanningScene()->isStateFeasible(*robot_state, verbose))
Representation of a robot's state. This includes position, velocity, acceleration and effort.
bool isValid(const ompl::base::State *wrapped_state, bool verbose) const override
Check validity for states of type ompl::base::ConstrainedStateSpace.
bool isValidityKnown() const
bool isGoalDistanceKnown() const
collision_detection::CollisionRequest collision_request_simple_
StateValidityChecker(const ModelBasedPlanningContext *planning_context)
const ModelBasedPlanningContext * planning_context_
double clearance(const ompl::base::State *state) const override
void setVerbose(bool flag)
virtual double cost(const ompl::base::State *state) const
bool isValid(const ompl::base::State *state) const override
collision_detection::CollisionRequest collision_request_with_distance_
collision_detection::CollisionRequest collision_request_with_cost_
collision_detection::CollisionRequest collision_request_with_distance_verbose_
collision_detection::CollisionRequest collision_request_simple_verbose_
rclcpp::Logger getLogger(const std::string &name)
Creates a namespaced logger.
The MoveIt interface to OMPL.
Representation of a collision checking result.
std::set< CostSource > cost_sources
These are the individual cost sources when costs are computed.
double distance
Closest distance between two bodies.
bool collision
True if collision was found, false otherwise.
When collision costs are computed, this structure contains information about the partial cost incurre...
double getVolume() const
Get the volume of the AABB around the cost source.
double cost
The partial cost (the probability of existence for the object there is a collision with).
Struct for containing the results of constraint evaluation.
bool satisfied
Whether or not the constraint or constraints were satisfied.
double distance
The distance evaluation from the constraint or constraints.
rclcpp::Logger getLogger()
bool getState(const std::shared_ptr< moveit_msgs::srv::GetRobotStateFromWarehouse::Request > &request, const std::shared_ptr< moveit_msgs::srv::GetRobotStateFromWarehouse::Response > &response, moveit_warehouse::RobotStateStorage &rs)