1 |
|
|
// |
2 |
|
|
// Copyright (C) 2012 LAAS-CNRS |
3 |
|
|
// |
4 |
|
|
// Author: Florent Lamiraux, |
5 |
|
|
// Mehdi Benallegue <mehdi@benallegue.com> |
6 |
|
|
// |
7 |
|
|
|
8 |
|
|
#ifndef SOT_TOOLS_OSCILLATOR_HH |
9 |
|
|
#define SOT_TOOLS_OSCILLATOR_HH |
10 |
|
|
|
11 |
|
|
#include <dynamic-graph/command-bind.h> |
12 |
|
|
#include <dynamic-graph/command-direct-getter.h> |
13 |
|
|
#include <dynamic-graph/command-direct-setter.h> |
14 |
|
|
#include <dynamic-graph/command-setter.h> |
15 |
|
|
#include <dynamic-graph/command.h> |
16 |
|
|
#include <dynamic-graph/entity.h> |
17 |
|
|
#include <dynamic-graph/factory.h> |
18 |
|
|
#include <dynamic-graph/signal-ptr.h> |
19 |
|
|
#include <dynamic-graph/signal-time-dependent.h> |
20 |
|
|
|
21 |
|
|
namespace dynamicgraph { |
22 |
|
|
namespace sot { |
23 |
|
|
namespace tools { |
24 |
|
|
|
25 |
|
|
class Oscillator : public Entity { |
26 |
|
|
DYNAMIC_GRAPH_ENTITY_DECL(); |
27 |
|
|
|
28 |
|
|
public: |
29 |
|
|
Oscillator(const std::string name); |
30 |
|
|
|
31 |
|
|
protected: |
32 |
|
|
double& computeSignal(double& sout, const int& t); |
33 |
|
|
dynamicgraph::Vector& computeVectorSignal(dynamicgraph::Vector& vsout, |
34 |
|
|
const int& t); |
35 |
|
|
double value(double dt, double time, double omega, double phase, |
36 |
|
|
double amplitude, double bias); |
37 |
|
|
|
38 |
|
|
SignalPtr<double, int> angularFrequencySIN_; |
39 |
|
|
SignalPtr<double, int> magnitudeSIN_; |
40 |
|
|
SignalPtr<double, int> phaseSIN_; |
41 |
|
|
SignalPtr<double, int> biasSIN_; |
42 |
|
|
SignalTimeDependent<double, int> soutSOUT_; |
43 |
|
|
SignalTimeDependent<dynamicgraph::Vector, int> vectorSoutSOUT_; |
44 |
|
|
|
45 |
|
|
double epsilon_; |
46 |
|
|
bool started_; |
47 |
|
|
bool continuous_; |
48 |
|
|
double dt_; |
49 |
|
|
double lastValue_; |
50 |
|
|
}; // class Oscillator |
51 |
|
|
|
52 |
|
|
} // namespace tools |
53 |
|
|
} // namespace sot |
54 |
|
|
} // namespace dynamicgraph |
55 |
|
|
|
56 |
|
|
#endif // SOT_TOOLS_OSCILLATOR_HH |