se2ez
motionbuilder.h
Go to the documentation of this file.
1 /* Author: Constantinos Chamzas */
2 #ifndef SE2EZ_EXPERIENCE_MOTIONBUILDER_
3 #define SE2EZ_EXPERIENCE_MOTIONBUILDER_
4 
5 #include <set>
6 #include <map>
8 
9 namespace se2ez
10 {
11  /** \cond IGNORE */
12  SE2EZ_CLASS_FORWARD(Robot)
13  SE2EZ_CLASS_FORWARD(Frame)
14  SE2EZ_CLASS_FORWARD(State)
15  SE2EZ_CLASS_FORWARD(CollisionAwareChainIK)
16  SE2EZ_CLASS_FORWARD(CollisionManager)
17  /** \endcond */
18 
19  /** \cond IGNORE */
20  SE2EZ_CLASS_FORWARD(MotionBuilder)
21  /** \endcond */
22 
23  /** \class se2ez::MotionBuilderPtr
24  \brief A shared pointer wrapper for se2ez::MotionBuilder. */
25 
26  /** \class se2ez::MotionBuilderConstPtr
27  \brief A const shared pointer wrapper for se2ez::MotionBuilder. */
28 
29  /** \brief Given a robot it generates queries (IK solutions for a specific set of frames)
30  */
32  {
33  public:
35 
36  /** \brief Type of the requested goal generation query.
37  */
38  enum QueryType
39  {
40  NAMED, ///< genGoals() returns only Named
41  FRAME, ///< genGoals() returns only states found with IK
42  ALL ///< genGoals() returns both of the above
43  };
44 
45  /** \name Constructors
46  \{ */
47 
48  /** \brief Constructor. Will generate queries for these samples
49  * \param[in] robot Robot to generate the queries for
50  * \param[in] ee End-effector to generate the queries for
51  * \param[in] frames Names of frames to find ik solutions
52  */
53  MotionBuilder(const RobotPtr &robot, const std::string &ee, const std::vector<std::string> &frames);
54 
55  /** \brief Constructor.
56  * \param[in] robot Robot to generate the queries from
57  * \param[in] ee End-effector to generate the queries for
58  * \param[in] prefix prefixes of frames (e.g., to find ik solutions)
59  */
60  MotionBuilder(const RobotPtr &robot, const std::string &ee, const std::string &prefix);
61 
62  // non-copyable
63  MotionBuilder(const MotionBuilder &) = delete;
64  MotionBuilder(MotionBuilder &&) = delete;
65 
66  /** \} */
67 
68  /** \name Getters and Setters
69  \{ */
70 
71  /** \brief generates the goals
72  * \return A map of the frames used for the EE and the ik solutions (goals).
73  */
74  const std::map<std::string, StatePtr> &genGoals(QueryType type);
75 
76  /** \brief Gets the motion planning queries as (Start, Goal) pairs.
77  * \return set of pairs of states.
78  */
79  const std::set<std::pair<StatePtr, StatePtr>> &getQueries(QueryType type = ALL);
80 
81  /** \} */
82 
83  private:
84  /** \brief Generates goals by finding IK solutions of the ee on the given frames.
85  */
86  void genFrameGoals();
87 
88  /** \brief Generates goals from the named states.
89  */
90  void genNamedGoals();
91 
92  /** \brief Generates both Frame and Named Goals.
93  */
94  void genAllGoals();
95 
96  // TODO: Only chain end effectors are suported for now
98  std::set<std::pair<StatePtr, StatePtr>> queries_; ///< valid motion planning queries (Start,Goal)
99  std::set<std::string> ees_; ///< eeposes to place the end effector
100 
101  RobotPtr robot_; ///< underlying robot to find configurations for
102  CollisionAwareChainIKPtr ik_; ///< the ik_solver
103  CollisionManagerPtr cm_; ///< the collision manager to be used by the ik_solver
104  const std::string ee_; ///< end effector used by the ik_solver
105  };
106 } // namespace se2ez
107 
108 #endif
std::set< std::string > ees_
eeposes to place the end effector
Definition: motionbuilder.h:99
genGoals() returns only states found with IK
Definition: motionbuilder.h:41
std::set< std::pair< StatePtr, StatePtr > > queries_
valid motion planning queries (Start,Goal)
Definition: motionbuilder.h:98
CollisionAwareChainIKPtr ik_
the ik_solver
const std::string ee_
end effector used by the ik_solver
CollisionManagerPtr cm_
the collision manager to be used by the ik_solver
#define SE2EZ_EIGEN_CLASS
Definition: class_forward.h:14
QueryType
Type of the requested goal generation query.
Definition: motionbuilder.h:38
Given a robot it generates queries (IK solutions for a specific set of frames)
Definition: motionbuilder.h:31
std::map< std::string, StatePtr > goals_
Valid goals.
Definition: motionbuilder.h:97
A shared pointer wrapper for se2ez::CollisionManager.
A shared pointer wrapper for se2ez::Robot.
genGoals() returns only Named
Definition: motionbuilder.h:40
Main namespace.
Definition: collision.h:11
RobotPtr robot_
underlying robot to find configurations for
#define SE2EZ_CLASS_FORWARD(C)
Definition: class_forward.h:9
A shared pointer wrapper for se2ez::CollisionAwareChainIK.