sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
motion-period.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_JOINTLIMITS_HH__
11 #define __SOT_JOINTLIMITS_HH__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 
20 /* SOT */
21 #include <dynamic-graph/all-signals.h>
22 #include <dynamic-graph/entity.h>
23 
25 
26 /* --------------------------------------------------------------------- */
27 /* --- API ------------------------------------------------------------- */
28 /* --------------------------------------------------------------------- */
29 
30 #if defined(WIN32)
31 #if defined(motion_period_EXPORTS)
32 #define SOTMOTIONPERIOD_EXPORT __declspec(dllexport)
33 #else
34 #define SOTMOTIONPERIOD_EXPORT __declspec(dllimport)
35 #endif
36 #else
37 #define SOTMOTIONPERIOD_EXPORT
38 #endif
39 
40 /* --------------------------------------------------------------------- */
41 /* --- CLASS ----------------------------------------------------------- */
42 /* --------------------------------------------------------------------- */
43 
47 namespace dynamicgraph {
48 namespace sot {
49 
50 class SOTMOTIONPERIOD_EXPORT MotionPeriod : public dynamicgraph::Entity {
51  public:
52  static const std::string CLASS_NAME;
53  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
54 
55  protected:
56  enum MotionPeriodType { MOTION_CONSTANT, MOTION_SIN, MOTION_COS };
57 
58  struct sotMotionParam {
60  unsigned int period;
61  unsigned int initPeriod;
62  double amplitude;
63  double initAmplitude;
64  };
65 
66  unsigned int size;
67  std::vector<sotMotionParam> motionParams;
68 
69  void resize(const unsigned int &size);
70 
71  /* --- SIGNALS ------------------------------------------------------------ */
72  public:
73  dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> motionSOUT;
74 
75  public:
76  MotionPeriod(const std::string &name);
77  virtual ~MotionPeriod(void) {}
78 
79  dynamicgraph::Vector &computeMotion(dynamicgraph::Vector &res,
80  const int &time);
81 
82  virtual void display(std::ostream &os) const;
83 };
84 
85 } /* namespace sot */
86 } /* namespace dynamicgraph */
87 
88 #endif // #ifndef __SOT_JOINTLIMITS_HH__
89 
90 /*
91  * Local variables:
92  * c-basic-offset: 2
93  * End:
94  */
Definition: motion-period.hh:50
static const std::string CLASS_NAME
Definition: motion-period.hh:52
MotionPeriodType
Definition: motion-period.hh:56
@ MOTION_CONSTANT
Definition: motion-period.hh:56
MotionPeriod(const std::string &name)
virtual void display(std::ostream &os) const
unsigned int size
Definition: motion-period.hh:66
virtual ~MotionPeriod(void)
Definition: motion-period.hh:77
std::vector< sotMotionParam > motionParams
Definition: motion-period.hh:67
dynamicgraph::Vector & computeMotion(dynamicgraph::Vector &res, const int &time)
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > motionSOUT
Definition: motion-period.hh:73
void resize(const unsigned int &size)
virtual const std::string & getClassName(void) const
Definition: motion-period.hh:53
#define SOTMOTIONPERIOD_EXPORT
Definition: motion-period.hh:37
Definition: abstract-sot-external-interface.hh:17
unsigned int period
Definition: motion-period.hh:60
MotionPeriodType motionType
Definition: motion-period.hh:59
double amplitude
Definition: motion-period.hh:62
double initAmplitude
Definition: motion-period.hh:63
unsigned int initPeriod
Definition: motion-period.hh:61