MIRA
AbstractDynamicWindow.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Redistribution and modification of this code is strictly prohibited.
9  *
10  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
11  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
12  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
13  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  *
15  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
16  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
18  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
19  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
20  */
21 
30 #ifndef _MIRA_PILOT_ABSTRACTDYNAMICWINDOW_H_
31 #define _MIRA_PILOT_ABSTRACTDYNAMICWINDOW_H_
32 
33 #include <serialization/adapters/std/list>
34 
36 #include <pilot/Objective.h>
37 #include <pilot/TrajectoryFamily.h>
38 
39 #include <fw/Channel.h>
40 
41 
42 namespace mira { namespace pilot {
43 
45 
47 {
49 public:
50 
52 
53 protected:
54 
55  virtual void initialize();
56 
57 public: // implements AbstractPlanner
58 
59  virtual Velocity2 planMotion();
60 
61 public:
62 
63  struct Cell
64  {
65  Cell() :
66  vote(Objective::Vote::ALLOW),
67  naySayer(0) {}
68 
69  Cell(const Velocity2& v, const Velocity2& r) :
70  vOff(v), radius(r),
71  vote(Objective::Vote::ALLOW),
72  naySayer(0) {}
73 
74  template<typename Reflector>
75  void reflect(Reflector& r)
76  {
77  r.member("VelocityOffset", vOff, "");
78  r.member("Radius", radius, "");
79  r.member("Vote", vote, "");
80  r.member("Votes", votes, "");
81  r.member("NaySayer", naySayer, "");
82  }
83 
84  // relative velocity offset to center of current window
86 
87  // the radius (size) of the cell
89  Objective::Vote vote; // the overall vote/cost for choosing this velocity
90  std::map<uint32, Objective::Vote> votes; // The votes of all objectives sorted by their id
91 
92  int naySayer; // id of objective that said "NOT_ADMISSABLE"
93  };
94 
95  struct BestAction {
97  BestAction(const Velocity2& iV, Objective::Vote iVote, const robot::PoseVelocityTrajectory& iTrajectory) :
98  v(iV), vote(iVote), trajectory(iTrajectory) {}
99 
100  template<typename Reflector>
101  void reflect(Reflector& r)
102  {
103  r.member("Velocity", v, "");
104  r.member("Vote", vote, "");
105  }
106 
110  };
111 
112  struct Config
113  {
114  template<typename Reflector>
115  void reflect(Reflector& r)
116  {
117  r.member("BestAction", bestAction, "");
118  r.member("Objectives", objectives, "");
119  r.member("Cells", cells, "");
120  r.member("CurrentVelocity", curV, "");
121  }
122 
123  boost::optional<BestAction> bestAction;
124  std::list<Cell> cells;
126  std::list<std::string> objectives;
127  };
128 
129 protected:
130 
132 
133 protected:
134 
135  virtual void buildCellLut() = 0;
136 
137 private:
138  void initializeCells(float dt);
139 
140  Channel<Config> mDbgDynamicWindow;
141  Channel<TrajectoryFamily> mDbgTrajectories;
142 };
143 
145 }}
146 
147 #endif
std::list< std::string > objectives
Definition: AbstractDynamicWindow.h:126
std::map< uint32, Objective::Vote > votes
Definition: AbstractDynamicWindow.h:90
Definition: AbstractDynamicWindow.h:46
Config mConfig
Definition: AbstractDynamicWindow.h:131
std::vector< PoseVelocityTrajectorySample, Eigen::aligned_allocator< PoseVelocityTrajectorySample > > PoseVelocityTrajectory
int naySayer
Definition: AbstractDynamicWindow.h:92
Definition: Objective.h:52
Cell(const Velocity2 &v, const Velocity2 &r)
Definition: AbstractDynamicWindow.h:69
Velocity2 curV
Definition: AbstractDynamicWindow.h:125
void reflect(Reflector &r)
Definition: AbstractDynamicWindow.h:75
std::list< Cell > cells
Definition: AbstractDynamicWindow.h:124
Base class for all planners that use objectives.
#define MIRA_ABSTRACT_OBJECT(classIdentifier)
BestAction()
Definition: AbstractDynamicWindow.h:96
Definition: AbstractDynamicWindow.h:112
Definition: AbstractDynamicWindow.h:95
robot::PoseVelocityTrajectory trajectory
Definition: AbstractDynamicWindow.h:109
boost::optional< BestAction > bestAction
Definition: AbstractDynamicWindow.h:123
void reflect(Reflector &r)
Definition: AbstractDynamicWindow.h:115
Definition: AbstractDynamicWindow.h:63
Velocity2 v
Definition: AbstractDynamicWindow.h:107
Cell()
Definition: AbstractDynamicWindow.h:65
Definition: AbstractObjectiveBasedPlanner.h:50
BestAction(const Velocity2 &iV, Objective::Vote iVote, const robot::PoseVelocityTrajectory &iTrajectory)
Definition: AbstractDynamicWindow.h:97
Definition: Objective.h:72
Objective::Vote vote
Definition: AbstractDynamicWindow.h:108
Velocity2 vOff
Definition: AbstractDynamicWindow.h:85
Description.
void reflect(Reflector &r)
Definition: AbstractDynamicWindow.h:101
Objective::Vote vote
Definition: AbstractDynamicWindow.h:89
Velocity2 radius
Definition: AbstractDynamicWindow.h:88