16 using namespace se2ez;
26 ik_ = std::make_shared<CollisionAwareChainIK>(
robot_, ee, 100);
27 for (
const auto &fname : frames)
35 for (
const auto &fname : robot->getFrameNames())
37 if (fname.find(prefix) != std::string::npos)
69 for (
auto it1 =
goals_.begin(); it1 !=
goals_.end(); ++it1)
71 queries_.emplace(it1->second, it2->second);
80 for (
const auto &ee :
ees_)
82 const auto &eepose =
robot_->getFrame(ee);
83 auto goal = std::make_shared<State>(
robot_);
85 if (
ik_->solve(goal, eepose->getTip()))
86 goals_.emplace(eepose->getName(), goal);
88 SE2EZ_WARN(
"IK solution for: %s with EE:%s was not found. \n. Did you Choose the correct EE?",
89 eepose->getName(),
ee_);
95 for (
auto pair :
robot_->getNamedStatesMap())
96 if (!
cm_->collide(pair.second))
97 goals_.emplace(pair.first, pair.second);
99 SE2EZ_WARN(
"Named state: %s is in collision", pair.second);
void genAllGoals()
Generates both Frame and Named Goals.
std::set< std::string > ees_
eeposes to place the end effector
const std::map< std::string, StatePtr > & genGoals(QueryType type)
generates the goals
genGoals() returns only states found with IK
std::set< std::pair< StatePtr, StatePtr > > queries_
valid motion planning queries (Start,Goal)
A collisions manager that uses Box2D as the underlying collision checking engine. ...
CollisionAwareChainIKPtr ik_
the ik_solver
const std::string ee_
end effector used by the ik_solver
const std::set< std::pair< StatePtr, StatePtr > > & getQueries(QueryType type=ALL)
Gets the motion planning queries as (Start, Goal) pairs.
CollisionManagerPtr cm_
the collision manager to be used by the ik_solver
#define SE2EZ_WARN(fmt,...)
QueryType
Type of the requested goal generation query.
void genNamedGoals()
Generates goals from the named states.
Given a robot it generates queries (IK solutions for a specific set of frames)
genGoals() returns both of the above
std::map< std::string, StatePtr > goals_
Valid goals.
A shared pointer wrapper for se2ez::Robot.
MotionBuilder(const RobotPtr &robot, const std::string &ee, const std::vector< std::string > &frames)
Constructor. Will generate queries for these samples.
genGoals() returns only Named
void genFrameGoals()
Generates goals by finding IK solutions of the ee on the given frames.
RobotPtr robot_
underlying robot to find configurations for
T emplace_back(T... args)