Skip to content
Open
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 @@ -92,6 +92,8 @@ class TrajOptDefaultPlanProfile : public TrajOptPlanProfile
const std::vector<std::string>& active_links,
int index) const override;

bool isFixedJoint() const override;

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

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class TrajOptPlanProfile
const std::vector<std::string>& active_links,
int index) const = 0;

virtual bool isFixedJoint() const = 0;

virtual tinyxml2::XMLElement* toXML(tinyxml2::XMLDocument& doc) const = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ void TrajOptDefaultPlanProfile::addConstraintErrorFunctions(trajopt::ProblemCons
}
}

bool TrajOptDefaultPlanProfile::isFixedJoint() const
{
// If the term type is constraint and all coefficients are non-zero
return (term_type == trajopt::TermType::TT_CNT) &&
(abs(joint_coeff.array()) >= std::numeric_limits<double>::epsilon()).all();
}

tinyxml2::XMLElement* TrajOptDefaultPlanProfile::toXML(tinyxml2::XMLDocument& doc) const
{
tinyxml2::XMLElement* xml_planner = doc.NewElement("Planner");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ TrajOptMotionPlanner::createProblem(const PlannerRequest& request) const
cur_plan_profile->apply(*pci, jwp, move_instruction, composite_mi, active_links, i);

// Add to fixed indices
if (!jwp.isToleranced()) /** @todo Should not make fixed if term_type is cost */
if (!jwp.isToleranced() && cur_plan_profile->isFixedJoint())
fixed_steps.push_back(i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class TrajOptIfoptDefaultPlanProfile : public TrajOptIfoptPlanProfile
const std::vector<std::string>& active_links,
int index) const override;

bool isFixedJoint() const override;

tinyxml2::XMLElement* toXML(tinyxml2::XMLDocument& doc) const override;
};
} // namespace tesseract_planning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class TrajOptIfoptPlanProfile
const std::vector<std::string>& active_links,
int index) const = 0;

virtual bool isFixedJoint() const = 0;

virtual tinyxml2::XMLElement* toXML(tinyxml2::XMLDocument& doc) const = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ void TrajOptIfoptDefaultPlanProfile::apply(TrajOptIfoptProblem& problem,
}
}

bool TrajOptIfoptDefaultPlanProfile::isFixedJoint() const
{
// If the term type is constraint and all coefficients are non-zero
return (term_type == TrajOptIfoptTermType::CONSTRAINT) &&
(abs(joint_coeff.array()) >= std::numeric_limits<double>::epsilon()).all();
Comment on lines +133 to +134
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjoomen Why do all coeff have to be non zero?

}

tinyxml2::XMLElement* TrajOptIfoptDefaultPlanProfile::toXML(tinyxml2::XMLDocument& /*doc*/) const
{
throw std::runtime_error("TrajOptIfoptDefaultPlanProfile::toXML is not implemented!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ std::shared_ptr<TrajOptIfoptProblem> TrajOptIfoptMotionPlanner::createProblem(co
cur_plan_profile->apply(*problem, jwp, move_instruction, composite_mi, active_links, i);

// Add to fixed indices
if (!jwp.isToleranced()) /** @todo Should not make fixed if term_type is cost */
if (!jwp.isToleranced() && cur_plan_profile->isFixedJoint())
fixed_steps.push_back(i);
}
}
Expand Down