step-queue.h
Go to the documentation of this file.
1 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  * Copyright Projet JRL-Japan, 2007
3  *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4  *
5  * File: StepQueue.h
6  * Project: SOT
7  * Author: Paul Evrard, Nicolas Mansard
8  *
9  * Version control
10  * ===============
11  *
12  * $Id$
13  *
14  * Description
15  * ============
16  *
17  * StepQueue entity: manages a step queue (a series of future steps,
18  * plus a series of changes in the future steps).
19  *
20  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
21 
22 #ifndef __SOT_STEPQUEUE_H__
23 #define __SOT_STEPQUEUE_H__
24 
25 /* --------------------------------------------------------------------- */
26 /* --- INCLUDE --------------------------------------------------------- */
27 /* --------------------------------------------------------------------- */
28 
29 /* SOT */
30 #include <dynamic-graph/entity.h>
31 
32 /* STD */
33 #include <deque>
34 #include <string>
35 
36 namespace dynamicgraph {
37 namespace sot {
38 
39 /* --------------------------------------------------------------------- */
40 /* --- API ------------------------------------------------------------- */
41 /* --------------------------------------------------------------------- */
42 
43 #if defined(WIN32)
44 #if defined(step_queue_EXPORTS)
45 #define StepQueue_EXPORT __declspec(dllexport)
46 #else
47 #define StepQueue_EXPORT __declspec(dllimport)
48 #endif
49 #else
50 #define StepQueue_EXPORT
51 #endif
52 
53 /* --------------------------------------------------------------------- */
54 /* --- CLASS ----------------------------------------------------------- */
55 /* --------------------------------------------------------------------- */
56 
59 
61  public:
62  FootPrint();
63  FootPrint(double x, double y, double theta, ContactName contact);
64 
65  double x, y, theta;
66  ContactName contact;
68 };
69 
71 
77 class StepQueue_EXPORT StepQueue : public Entity {
78  public: // Entity name
79  static const std::string CLASS_NAME;
80  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
81 
82  private: // Parameters
83  static const unsigned int QUEUE_SIZE;
84  static const double ZERO_STEP_POSITION;
85  static const FootPrint START_FOOT_PRINT;
86 
87  public: // Construction
91  StepQueue(const std::string &name);
92 
93  public: // Queue manipulation
96  void startSequence();
97 
101  void pushStep(double x, double y, double theta);
102 
104  const FootPrint &getStep(unsigned int index) const;
107  const FootPrint &getFirstStep() const;
108  const FootPrint &getLastStep() const;
110 
112  void changeFirstStep(double x, double y, double dtheta);
113 
114  const FootPrint &getFirstStepChange() const;
115 
118  bool isFirstStepChanged() const;
119 
120  public: // Queue properties
122  unsigned int size() const;
124  const FootPrint &getStartFootPrint() const;
125  double getZeroStepPosition() const;
127 
128  public: // Entity
129  virtual void display(std::ostream &os) const;
130  virtual void commandLine(const std::string &cmdLine,
131  std::istringstream &cmdArgs, std::ostream &os);
132 
133  private:
134  std::deque<FootPrint> footPrintList;
135  FootPrint firstStepChange;
136  bool firstStepChanged;
137 };
138 
139 } // namespace sot
140 } // namespace dynamicgraph
141 
142 #endif
dynamicgraph::sot::CONTACT_LEFT_FOOT
@ CONTACT_LEFT_FOOT
Definition: step-queue.h:58
dynamicgraph::sot::FootPrint
Definition: step-queue.h:60
dynamicgraph
Definition: exception-pg.h:47
StepQueue_EXPORT
#define StepQueue_EXPORT
Definition: step-queue.h:50
dynamicgraph::sot::StepQueue::CLASS_NAME
static const std::string CLASS_NAME
Definition: step-queue.h:79
dynamicgraph::sot::ContactName
ContactName
Support foot identifier.
Definition: step-queue.h:58
dynamicgraph::sot::FootPrint::y
double y
Definition: step-queue.h:65
dynamicgraph::sot::StepQueue::getClassName
virtual const std::string & getClassName(void) const
Definition: step-queue.h:80
dynamicgraph::sot::StepQueue
A step queue in the preview window.
Definition: step-queue.h:77
dynamicgraph::sot::CONTACT_RIGHT_FOOT
@ CONTACT_RIGHT_FOOT
Definition: step-queue.h:58