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 namespace dg = dynamicgraph;
20 
21 /* SOT */
22 #include <dynamic-graph/all-signals.h>
23 #include <dynamic-graph/entity.h>
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 namespace dg = dynamicgraph;
51 
52 class SOTMOTIONPERIOD_EXPORT MotionPeriod : public dg::Entity {
53 
54 public:
55  static const std::string CLASS_NAME;
56  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
57 
58 protected:
59  enum MotionPeriodType { MOTION_CONSTANT, MOTION_SIN, MOTION_COS };
60 
61  struct sotMotionParam {
63  unsigned int period;
64  unsigned int initPeriod;
65  double amplitude;
66  double initAmplitude;
67  };
68 
69  unsigned int size;
70  std::vector<sotMotionParam> motionParams;
71 
72  void resize(const unsigned int &size);
73 
74  /* --- SIGNALS ------------------------------------------------------------ */
75 public:
76  dg::SignalTimeDependent<dg::Vector, int> motionSOUT;
77 
78 public:
79  MotionPeriod(const std::string &name);
80  virtual ~MotionPeriod(void) {}
81 
82  dg::Vector &computeMotion(dg::Vector &res, const int &time);
83 
84  virtual void display(std::ostream &os) const;
85 };
86 
87 } /* namespace sot */
88 } /* namespace dynamicgraph */
89 
90 #endif // #ifndef __SOT_JOINTLIMITS_HH__
91 
92 /*
93  * Local variables:
94  * c-basic-offset: 2
95  * End:
96  */
dynamicgraph::sot::MotionPeriod::motionParams
std::vector< sotMotionParam > motionParams
Definition: motion-period.hh:70
dynamicgraph::sot::MotionPeriod::MotionPeriodType
MotionPeriodType
Definition: motion-period.hh:59
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
SOTMOTIONPERIOD_EXPORT
#define SOTMOTIONPERIOD_EXPORT
Definition: motion-period.hh:37
dynamicgraph::sot::MotionPeriod::sotMotionParam::period
unsigned int period
Definition: motion-period.hh:63
dynamicgraph::sot::MotionPeriod::getClassName
virtual const std::string & getClassName(void) const
Definition: motion-period.hh:56
dynamicgraph::sot::MotionPeriod::size
unsigned int size
Definition: motion-period.hh:69
dynamicgraph::sot::MotionPeriod::sotMotionParam
Definition: motion-period.hh:61
dynamicgraph::sot::MotionPeriod::CLASS_NAME
static const std::string CLASS_NAME
Definition: motion-period.hh:55
dynamicgraph::sot::MotionPeriod
Definition: motion-period.hh:52
dynamicgraph::sot::MotionPeriod::~MotionPeriod
virtual ~MotionPeriod(void)
Definition: motion-period.hh:80
dynamicgraph::sot::MotionPeriod::sotMotionParam::initAmplitude
double initAmplitude
Definition: motion-period.hh:66
dynamicgraph::sot::MotionPeriod::sotMotionParam::amplitude
double amplitude
Definition: motion-period.hh:65
exception-task.hh
dynamicgraph::sot::MotionPeriod::sotMotionParam::initPeriod
unsigned int initPeriod
Definition: motion-period.hh:64
dynamicgraph::sot::MotionPeriod::sotMotionParam::motionType
MotionPeriodType motionType
Definition: motion-period.hh:62
dynamicgraph::sot::MotionPeriod::motionSOUT
dg::SignalTimeDependent< dg::Vector, int > motionSOUT
Definition: motion-period.hh:76