Skip to content

Commit

Permalink
Add simple ompl profile interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Dec 12, 2024
1 parent ad73309 commit 29ba1ed
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 875 deletions.
4 changes: 1 addition & 3 deletions tesseract_motion_planners/ompl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ set(OMPL_SRC
src/profile/ompl_default_plan_profile.cpp
src/utils.cpp
src/state_collision_validator.cpp
src/compound_state_validator.cpp
src/serialize.cpp
src/deserialize.cpp)
src/compound_state_validator.cpp)

# if(NOT OMPL_VERSION VERSION_LESS "1.4.0") list(APPEND OMPL_SRC src/config/ompl_planner_constrained_config.cpp) endif()

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ class OMPLMotionPlanner : public MotionPlanner
protected:
/** @brief OMPL Parallel planner */
std::shared_ptr<ompl::tools::ParallelPlan> parallel_plan_;

OMPLProblemConfig createSubProblem(const PlannerRequest& request,
const tesseract_common::ManipulatorInfo& composite_mi,
const std::shared_ptr<const tesseract_kinematics::JointGroup>& manip,
const MoveInstructionPoly& start_instruction,
const MoveInstructionPoly& end_instruction,
int n_output_states,
int index) const;
};

} // namespace tesseract_planning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ class OMPLDefaultPlanProfile : public OMPLPlanProfile
using ConstPtr = std::shared_ptr<const OMPLDefaultPlanProfile>;

OMPLDefaultPlanProfile();
OMPLDefaultPlanProfile(const tinyxml2::XMLElement& xml_element);

/** @brief The OMPL state space to use when planning */
OMPLProblemStateSpace state_space{ OMPLProblemStateSpace::REAL_STATE_SPACE };

/** @brief Max planning time allowed in seconds */
Expand Down Expand Up @@ -104,53 +102,42 @@ class OMPLDefaultPlanProfile : public OMPLPlanProfile
/** @brief The collision check configuration */
tesseract_collision::CollisionCheckConfig collision_check_config;

std::unique_ptr<OMPLProblem> create(const PlannerRequest& request,
const MoveInstructionPoly& start_instruction,
const MoveInstructionPoly& end_instruction,
int n_output_states) const override;

protected:
/** @brief The state sampler allocator. This can be null and it will use Tesseract default state sampler allocator. */
StateSamplerAllocator state_sampler_allocator;
StateSamplerAllocator state_sampler_allocator_;

/** @brief Set the optimization objective function allocator. Default is to minimize path length */
OptimizationObjectiveAllocator optimization_objective_allocator;
OptimizationObjectiveAllocator optimization_objective_allocator_;

/** @brief The ompl state validity checker. If nullptr and collision checking enabled it uses
* StateCollisionValidator */
StateValidityCheckerAllocator svc_allocator;
StateValidityCheckerAllocator svc_allocator_;

/** @brief The ompl motion validator. If nullptr and continuous collision checking enabled it used
* ContinuousMotionValidator */
MotionValidatorAllocator mv_allocator;
MotionValidatorAllocator mv_allocator_;

void setup(OMPLProblem& prob) const override;
void setup(OMPLProblem& prob) const;

void applyGoalStates(OMPLProblem& prob,
const Eigen::Isometry3d& cartesian_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const override;
const tesseract_common::ManipulatorInfo& manip_info) const;

void applyGoalStates(OMPLProblem& prob,
const Eigen::VectorXd& joint_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const override;
void applyGoalStates(OMPLProblem& prob, const Eigen::VectorXd& joint_waypoint) const;

void applyStartStates(OMPLProblem& prob,
const Eigen::Isometry3d& cartesian_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const override;
const tesseract_common::ManipulatorInfo& manip_info) const;

void applyStartStates(OMPLProblem& prob,
const Eigen::VectorXd& joint_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const override;
void applyStartStates(OMPLProblem& prob, const Eigen::VectorXd& joint_waypoint) const;

tinyxml2::XMLElement* toXML(tinyxml2::XMLDocument& doc) const override;

protected:
ompl::base::StateValidityCheckerPtr processStateValidator(OMPLProblem& prob) const;
void processMotionValidator(OMPLProblem& prob,
const ompl::base::StateValidityCheckerPtr& svc_without_collision) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_common/fwd.h>
#include <tesseract_kinematics/core/fwd.h>
#include <tesseract_environment/fwd.h>
#include <tesseract_command_language/fwd.h>
#include <tesseract_motion_planners/core/fwd.h>

#include <tesseract_command_language/profile.h>

namespace tinyxml2
Expand All @@ -46,6 +50,7 @@ class XMLDocument;
namespace tesseract_planning
{
struct OMPLProblem;

class OMPLPlanProfile : public Profile
{
public:
Expand All @@ -60,46 +65,25 @@ class OMPLPlanProfile : public Profile
*/
static std::size_t getStaticKey();

virtual void setup(OMPLProblem& prob) const = 0;

virtual void applyGoalStates(OMPLProblem& prob,
const Eigen::Isometry3d& cartesian_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const = 0;

virtual void applyGoalStates(OMPLProblem& prob,
const Eigen::VectorXd& joint_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const = 0;

virtual void applyStartStates(OMPLProblem& prob,
const Eigen::Isometry3d& cartesian_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const = 0;

virtual void applyStartStates(OMPLProblem& prob,
const Eigen::VectorXd& joint_waypoint,
const MoveInstructionPoly& parent_instruction,
const tesseract_common::ManipulatorInfo& manip_info,
const std::vector<std::string>& active_links,
int index) const = 0;

virtual tinyxml2::XMLElement* toXML(tinyxml2::XMLDocument& doc) const = 0;
/**
* @brief Create OMPL Planning Problem
* @param request The planning request
* @param start_instruction The start instruction
* @param end_instruction The goal instruction
* @param n_output_states The number of interpolated output states
* @return A OMPL Problem
*/
virtual std::unique_ptr<OMPLProblem> create(const PlannerRequest& request,
const MoveInstructionPoly& start_instruction,
const MoveInstructionPoly& end_instruction,
int n_output_states) const = 0;

protected:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive&, const unsigned int); // NOLINT
};

/** @todo Currently OMPL does not have support of composite profile everything is handled by the plan profile */

} // namespace tesseract_planning

BOOST_CLASS_EXPORT_KEY(tesseract_planning::OMPLPlanProfile)
Expand Down

This file was deleted.

Loading

0 comments on commit 29ba1ed

Please sign in to comment.