Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove env_state from planning request #547

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
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ struct PlannerRequest
/** @brief The environment */
std::shared_ptr<const tesseract_environment::Environment> env;

/** @brief The start state to use for planning */
tesseract_scene_graph::SceneState env_state;

/** @brief The profile dictionary */
std::shared_ptr<const ProfileDictionary> profiles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ DescartesMotionPlanner<FloatType>::createProblem(const PlannerRequest& request)
return prob;
}

prob->env_state = request.env_state;
prob->env = request.env;
prob->env_state = request.env->getState();

std::vector<std::string> joint_names = prob->manip->getJointNames();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ TEST(TesseractPlanningDescartesSerializeUnit, SerializeDescartesDefaultPlanToXml

TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerFixedPoses) // NOLINT
{
// Create the planner and the responses that will store the results
PlannerResponse planning_response;

tesseract_kinematics::KinematicGroup::Ptr kin_group =
env_->getKinematicGroup(manip.manipulator, manip.manipulator_ik_solver);
auto cur_state = env_->getState();

// Specify a start waypoint
CartesianWaypointPoly wp1{ CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -.20, 0.8) *
Eigen::Quaterniond(0, 0, -1.0, 0)) };
Expand All @@ -137,8 +130,7 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerFixedPoses) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a seed
CompositeInstruction interpolated_program =
generateInterpolatedProgram(program, cur_state, env_, 3.14, 1.0, 3.14, 10);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env_, 3.14, 1.0, 3.14, 10);

// Create Profiles
auto plan_profile = std::make_shared<DescartesDefaultPlanProfileD>();
Expand All @@ -155,7 +147,6 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerFixedPoses) // NOLINT
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env_;
request.env_state = cur_state;
request.profiles = profiles;

PlannerResponse single_planner_response = single_descartes_planner.solve(request);
Expand Down Expand Up @@ -221,13 +212,6 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerFixedPoses) // NOLINT

TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerAxialSymetric) // NOLINT
{
// Create the planner and the responses that will store the results
PlannerResponse planning_response;

tesseract_kinematics::KinematicGroup::Ptr kin_group =
env_->getKinematicGroup(manip.manipulator, manip.manipulator_ik_solver);
auto cur_state = env_->getState();

// Specify a start waypoint
CartesianWaypointPoly wp1{ CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -.20, 0.8) *
Eigen::Quaterniond(0, 0, -1.0, 0)) };
Expand All @@ -249,8 +233,7 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerAxialSymetric) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a seed
CompositeInstruction interpolated_program =
generateInterpolatedProgram(program, cur_state, env_, 3.14, 1.0, 3.14, 10);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env_, 3.14, 1.0, 3.14, 10);

// Create Profiles
auto plan_profile = std::make_shared<DescartesDefaultPlanProfileD>();
Expand All @@ -271,7 +254,6 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerAxialSymetric) // NOLINT
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env_;
request.env_state = cur_state;
request.profiles = profiles;

auto problem = single_descartes_planner.createProblem(request);
Expand Down Expand Up @@ -324,13 +306,6 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerAxialSymetric) // NOLINT

TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerCollisionEdgeEvaluator) // NOLINT
{
// Create the planner and the responses that will store the results
PlannerResponse planning_response;

tesseract_kinematics::KinematicGroup::Ptr kin_group =
env_->getKinematicGroup(manip.manipulator, manip.manipulator_ik_solver);
auto cur_state = env_->getState();

// Specify a start waypoint
CartesianWaypointPoly wp1{ CartesianWaypoint(Eigen::Isometry3d::Identity() * Eigen::Translation3d(0.8, -.10, 0.8) *
Eigen::Quaterniond(0, 0, -1.0, 0)) };
Expand All @@ -352,7 +327,7 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerCollisionEdgeEvaluator)
program.appendMoveInstruction(plan_f1);

// Create a seed
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, cur_state, env_, 3.14, 1.0, 3.14, 2);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env_, 3.14, 1.0, 3.14, 2);

// Create Profiles
auto plan_profile = std::make_shared<DescartesDefaultPlanProfileD>();
Expand All @@ -370,7 +345,6 @@ TEST_F(TesseractPlanningDescartesUnit, DescartesPlannerCollisionEdgeEvaluator)
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env_;
request.env_state = cur_state;
request.profiles = profiles;

// Create Planner
Expand Down
4 changes: 2 additions & 2 deletions tesseract_motion_planners/ompl/src/ompl_motion_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ OMPLMotionPlanner::createSubProblem(const PlannerRequest& request,
config.end_uuid = end_instruction.getUUID();
config.problem = std::make_shared<OMPLProblem>();
config.problem->env = request.env;
config.problem->env_state = request.env_state;
config.problem->env_state = request.env->getState();
config.problem->manip = manip;
config.problem->contact_checker = request.env->getDiscreteContactManager();
config.problem->contact_checker->setCollisionObjectsTransform(request.env_state.link_transforms);
config.problem->contact_checker->setCollisionObjectsTransform(config.problem->env_state.link_transforms);
config.problem->contact_checker->setActiveCollisionObjects(active_link_names);

cur_plan_profile->setup(*config.problem);
Expand Down
16 changes: 5 additions & 11 deletions tesseract_motion_planners/ompl/test/ompl_planner_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespacePlannerUnit) // NOLINT

// Step 3: Create ompl planner config and populate it
auto joint_group = env->getJointGroup(manip.manipulator);
auto cur_state = env->getState();

// Specify a start waypoint
JointWaypointPoly wp1{ JointWaypoint(
Expand All @@ -225,7 +224,7 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespacePlannerUnit) // NOLINT
program.appendMoveInstruction(plan_f2);

// Create a seed
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, cur_state, env, 3.14, 1.0, 3.14, 10);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env, 3.14, 1.0, 3.14, 10);

// Create Profiles
auto plan_profile = std::make_shared<OMPLDefaultPlanProfile>();
Expand All @@ -248,7 +247,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespacePlannerUnit) // NOLINT
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env;
request.env_state = cur_state;
request.profiles = profiles;

// Create Planner and solve
Expand Down Expand Up @@ -295,7 +293,7 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespacePlannerUnit) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a new seed
interpolated_program = generateInterpolatedProgram(program, cur_state, env, 3.14, 1.0, 3.14, 10);
interpolated_program = generateInterpolatedProgram(program, env, 3.14, 1.0, 3.14, 10);

// Update Configuration
request.instructions = interpolated_program;
Expand Down Expand Up @@ -328,7 +326,7 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespacePlannerUnit) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a new seed
interpolated_program = generateInterpolatedProgram(program, cur_state, env, 3.14, 1.0, 3.14, 10);
interpolated_program = generateInterpolatedProgram(program, env, 3.14, 1.0, 3.14, 10);

// Update Configuration
request.instructions = interpolated_program;
Expand Down Expand Up @@ -364,7 +362,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianGoalPlannerUnit) // NOLINT

// Step 3: Create ompl planner config and populate it
auto kin_group = env->getKinematicGroup(manip.manipulator);
auto cur_state = env->getState();

// Specify a start waypoint
JointWaypointPoly wp1{ JointWaypoint(
Expand All @@ -389,7 +386,7 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianGoalPlannerUnit) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a seed
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, cur_state, env, 3.14, 1.0, 3.14, 10);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env, 3.14, 1.0, 3.14, 10);

// Create Profiles
auto plan_profile = std::make_shared<OMPLDefaultPlanProfile>();
Expand All @@ -412,7 +409,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianGoalPlannerUnit) // NOLINT
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env;
request.env_state = cur_state;
request.profiles = profiles;

// Create Planner and solve
Expand Down Expand Up @@ -459,7 +455,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianStartPlannerUnit) // NOLINT

// Step 3: Create ompl planner config and populate it
auto kin_group = env->getKinematicGroup(manip.manipulator);
auto cur_state = env->getState();

// Specify a start waypoint
auto start_jv = Eigen::Map<const Eigen::VectorXd>(start_state.data(), static_cast<long>(start_state.size()));
Expand All @@ -484,7 +479,7 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianStartPlannerUnit) // NOLINT
program.appendMoveInstruction(plan_f1);

// Create a seed
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, cur_state, env, 3.14, 1.0, 3.14, 10);
CompositeInstruction interpolated_program = generateInterpolatedProgram(program, env, 3.14, 1.0, 3.14, 10);

// Create Profiles
auto plan_profile = std::make_shared<OMPLDefaultPlanProfile>();
Expand All @@ -507,7 +502,6 @@ TYPED_TEST(OMPLTestFixture, OMPLFreespaceCartesianStartPlannerUnit) // NOLINT
PlannerRequest request;
request.instructions = interpolated_program;
request.env = env;
request.env_state = cur_state;
request.profiles = profiles;

// Create Planner and solve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ namespace tesseract_planning
/** @brief The Joint Group Instruction Information struct */
struct JointGroupInstructionInfo
{
JointGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const PlannerRequest& request,
const tesseract_common::ManipulatorInfo& manip_info);

JointGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const tesseract_environment::Environment& env,
const tesseract_common::ManipulatorInfo& manip_info);
Expand Down Expand Up @@ -101,10 +97,6 @@ struct JointGroupInstructionInfo
/** @brief The Kinematic Group Instruction Information struct */
struct KinematicGroupInstructionInfo
{
KinematicGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const PlannerRequest& request,
const tesseract_common::ManipulatorInfo& manip_info);

KinematicGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const tesseract_environment::Environment& env,
const tesseract_common::ManipulatorInfo& manip_info);
Expand Down Expand Up @@ -515,7 +507,6 @@ std::array<Eigen::VectorXd, 2> getClosestJointSolution(const KinematicGroupInstr

/** @brief Provided for backwards compatibility */
CompositeInstruction generateInterpolatedProgram(const CompositeInstruction& instructions,
const tesseract_scene_graph::SceneState& current_state,
const std::shared_ptr<const tesseract_environment::Environment>& env,
double state_longest_valid_segment_length = 5 * M_PI / 180,
double translation_longest_valid_segment_length = 0.15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SimplePlannerFixedSizeAssignPlanProfile : public SimplePlannerPlanProfile
const MoveInstructionPoly& prev_seed,
const MoveInstructionPoly& base_instruction,
const InstructionPoly& next_instruction,
const PlannerRequest& request,
const std::shared_ptr<const tesseract_environment::Environment>& env,
const tesseract_common::ManipulatorInfo& global_manip_info) const override;

/** @brief The number of steps to use for freespace instruction */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SimplePlannerFixedSizePlanProfile : public SimplePlannerPlanProfile
const MoveInstructionPoly& prev_seed,
const MoveInstructionPoly& base_instruction,
const InstructionPoly& next_instruction,
const PlannerRequest& request,
const std::shared_ptr<const tesseract_environment::Environment>& env,
const tesseract_common::ManipulatorInfo& global_manip_info) const override;

/** @brief The number of steps to use for freespace instruction */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SimplePlannerLVSNoIKPlanProfile : public SimplePlannerPlanProfile
const MoveInstructionPoly& prev_seed,
const MoveInstructionPoly& base_instruction,
const InstructionPoly& next_instruction,
const PlannerRequest& request,
const std::shared_ptr<const tesseract_environment::Environment>& env,
const tesseract_common::ManipulatorInfo& global_manip_info) const override;

/** @brief The maximum joint distance, the norm of changes to all joint positions between successive steps. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SimplePlannerLVSPlanProfile : public SimplePlannerPlanProfile
const MoveInstructionPoly& prev_seed,
const MoveInstructionPoly& base_instruction,
const InstructionPoly& next_instruction,
const PlannerRequest& request,
const std::shared_ptr<const tesseract_environment::Environment>& env,
const tesseract_common::ManipulatorInfo& global_manip_info) const override;

/** @brief The maximum joint distance, the norm of changes to all joint positions between successive steps. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP

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

Expand Down Expand Up @@ -73,7 +74,7 @@ class SimplePlannerPlanProfile : public Profile
const MoveInstructionPoly& prev_seed,
const MoveInstructionPoly& base_instruction,
const InstructionPoly& next_instruction,
const PlannerRequest& request,
const std::shared_ptr<const tesseract_environment::Environment>& env,
const tesseract_common::ManipulatorInfo& global_manip_info) const = 0;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_motion_planners/core/planner.h>
#include <tesseract_command_language/fwd.h>
#include <tesseract_scene_graph/fwd.h>

namespace tesseract_planning
{
Expand Down Expand Up @@ -66,9 +67,10 @@ class SimpleMotionPlanner : public MotionPlanner
std::unique_ptr<MotionPlanner> clone() const override;

protected:
CompositeInstruction processCompositeInstruction(const CompositeInstruction& instructions,
MoveInstructionPoly& prev_instruction,
CompositeInstruction processCompositeInstruction(MoveInstructionPoly& prev_instruction,
MoveInstructionPoly& prev_seed,
const CompositeInstruction& instructions,
const tesseract_scene_graph::SceneState& start_state,
const PlannerRequest& request) const;
};

Expand Down
16 changes: 0 additions & 16 deletions tesseract_motion_planners/simple/src/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP

namespace tesseract_planning
{
JointGroupInstructionInfo::JointGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const PlannerRequest& request,
const tesseract_common::ManipulatorInfo& manip_info)
: JointGroupInstructionInfo(plan_instruction, *request.env, manip_info)
{
}

JointGroupInstructionInfo::JointGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const tesseract_environment::Environment& env,
const tesseract_common::ManipulatorInfo& manip_info)
Expand Down Expand Up @@ -129,13 +122,6 @@ const Eigen::VectorXd& JointGroupInstructionInfo::extractJointPosition() const
return getJointPosition(instruction.getWaypoint());
}

KinematicGroupInstructionInfo::KinematicGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const PlannerRequest& request,
const tesseract_common::ManipulatorInfo& manip_info)
: KinematicGroupInstructionInfo(plan_instruction, *request.env, manip_info)
{
}

KinematicGroupInstructionInfo::KinematicGroupInstructionInfo(const MoveInstructionPoly& plan_instruction,
const tesseract_environment::Environment& env,
const tesseract_common::ManipulatorInfo& manip_info)
Expand Down Expand Up @@ -1325,7 +1311,6 @@ std::array<Eigen::VectorXd, 2> getClosestJointSolution(const KinematicGroupInstr
}

CompositeInstruction generateInterpolatedProgram(const CompositeInstruction& instructions,
const tesseract_scene_graph::SceneState& current_state,
const std::shared_ptr<const tesseract_environment::Environment>& env,
double state_longest_valid_segment_length,
double translation_longest_valid_segment_length,
Expand All @@ -1335,7 +1320,6 @@ CompositeInstruction generateInterpolatedProgram(const CompositeInstruction& ins
// Fill out request and response
PlannerRequest request;
request.instructions = instructions;
request.env_state = current_state;
request.env = env;

// Set up planner
Expand Down
Loading
Loading