1 #include <moveit/ompl_interface/model_based_planning_context.h>
24 interface_.reset(
new ompl_interface::OMPLInterface(robot_->getModel(), handler_.getHandle()));
32 auto &pcm = interface_->getPlanningContextManager();
50 return interface_->getPlanningContext(
scene->getSceneConst(), request);
56 refreshContext(
scene, request,
true);
63 response.
error_code_.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
65 refreshContext(
scene, request);
69 if (pre_plan_callback_)
70 pre_plan_callback_(context_,
scene, request);
72 context_->solve(response);
79 refreshContext(
scene, request);
83 const auto &planner = ss_->getPlanner();
85 #if ROBOWFLEX_AT_LEAST_KINETIC
86 return planner->getPlannerProgressProperties();
91 for (
const auto &pair : planner->getPlannerProgressProperties())
93 auto function = pair.second;
94 ret[pair.first] = [
function] {
return function(); };
105 const auto &scene_id =
scene->getKey();
108 bool same_scene =
compareIDs(scene_id, last_scene_id_);
109 bool same_request = request_hash == last_request_hash_;
111 if (not force and ss_ and same_scene and same_request)
113 RBX_INFO(
"Reusing Cached Context!");
117 context_ = getPlanningContext(
scene, request);
125 #if ROBOWFLEX_AT_LEAST_MELODIC
126 context_->setInterpolation(interpolate_);
127 context_->setHybridize(hybridize_);
130 ss_ = context_->getOMPLSimpleSetup();
132 last_scene_id_ = scene_id;
133 last_request_hash_ = request_hash;
152 RBX_WARN(
"Interface is not initialized before call to OMPLInterfacePlanner::initialize.");
159 pre_plan_callback_ = prePlanCallback;
ompl_interface::OMPLInterface & getInterface() const
Access the OMPLInterface directly, to customize the planning process.
void setPrePlanCallback(const PrePlanCallback &prePlanCallback)
Set a callback, to be called right before a planning session for last-minute configuration or externa...
void preRun(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override
This function is called before benchmarking.
bool initialize(const std::string &config_file="", const OMPL::Settings settings=Settings())
Initialize planning pipeline.
ompl_interface::ModelBasedPlanningContextPtr getPlanningContext(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const
Returns the planning context used for this motion planning request.
planning_interface::MotionPlanResponse plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override
Plan a motion given a request and a scene. Uses the planning pipeline's generatePlan() method,...
std::map< std::string, Planner::ProgressProperty > getProgressProperties(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const override
Retrieve the planner progress property map for this planner given a specific request.
void refreshContext(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, bool force=false) const
Refreshes the internal planning context.
std::vector< std::string > getPlannerConfigs() const override
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
ompl::geometric::SimpleSetupPtr getLastSimpleSetup() const
Get the last OMPL simple setup used in planning.
OMPLInterfacePlanner(const RobotPtr &robot, const std::string &name="")
Constructor.
Settings descriptor for settings provided by the default MoveIt! OMPL planning pipeline.
void setParam(IO::Handler &handler) const
Sets member variables on the parameter server using handler.
int minimum_waypoint_count
Minimum number of waypoints in output path.
int max_goal_samples
Maximum number of successful goal samples to keep.
int max_state_sampling_attempts
Maximum number of attempts to sample a new state.
int max_planning_threads
Maximum number of threads used to service a request.
bool interpolate_solutions
Whether or not planner should interpolate solutions.
bool hybridize_solutions
Whether or not planner should hybridize solutions.
double max_solution_segment_length
Maximum solution segment length.
double maximum_waypoint_distance
Maximum distance between waypoints in path.
bool simplify_solutions
Whether or not planner should simplify solutions.
int max_goal_sampling_attempts
Maximum number of attempts to sample a goal.
An abstract interface to a motion planning algorithm.
A shared pointer wrapper for robowflex::Robot.
A const shared pointer wrapper for robowflex::Scene.
#define RBX_WARN(fmt,...)
Output a warning logging message.
#define RBX_ERROR(fmt,...)
Output a error logging message.
#define RBX_INFO(fmt,...)
Output a info logging message.
moveit_msgs::MotionPlanRequest MotionPlanRequest
Functions for loading and animating robots in Blender.
std::string getMessageMD5(T &msg)
Compute MD5 hash of message.
bool loadOMPLConfig(IO::Handler &handler, const std::string &config_file, std::vector< std::string > &configs)
Loads an OMPL configuration YAML file onto the parameter server.
Main namespace. Contains all library classes and functions.
bool compareIDs(const ID &a, const ID &b)
Compare two ID objects.
Functions for loading and animating scenes in Blender.
moveit_msgs::MoveItErrorCodes error_code_