smooth-reach.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_SMOOTHREACH_H_H
11 #define __SOT_SMOOTHREACH_H_H
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>
24 
25 /* --------------------------------------------------------------------- */
26 /* --- API ------------------------------------------------------------- */
27 /* --------------------------------------------------------------------- */
28 
29 #if defined(WIN32)
30 #if defined(com_freezer_EXPORTS)
31 #define SOTSMOOTHREACH_EXPORT __declspec(dllexport)
32 #else
33 #define SOTSMOOTHREACH_EXPORT __declspec(dllimport)
34 #endif
35 #else
36 #define SOTSMOOTHREACH_EXPORT
37 #endif
38 
39 namespace dynamicgraph {
40 namespace sot {
41 
42 namespace dg = dynamicgraph;
43 
44 /* --------------------------------------------------------------------- */
45 /* --- CLASS ----------------------------------------------------------- */
46 /* --------------------------------------------------------------------- */
47 
48 class SOTSMOOTHREACH_EXPORT SmoothReach : public dg::Entity {
49 public:
50  static const std::string CLASS_NAME;
51  virtual const std::string &getClassName() const { return CLASS_NAME; }
52 
53 private:
54  dg::Vector start, goal;
55  int startTime, lengthTime;
56  bool isStarted, isParam;
57  int smoothMode;
58  double smoothParam;
59 
60  double smoothFunction(double x);
61 
62 public: /* --- CONSTRUCTION --- */
63  SmoothReach(const std::string &name);
64  virtual ~SmoothReach(void){};
65 
66 public: /* --- SIGNAL --- */
67  dg::SignalPtr<dg::Vector, int> startSIN;
68  dg::SignalTimeDependent<dg::Vector, int> goalSOUT;
69  // dg::SignalTimeDependent<double, int> percentSOUT;
70 
71 public: /* --- FUNCTION --- */
72  dg::Vector &goalSOUT_function(dg::Vector &goal, const int &time);
73 
74  void set(const dg::Vector &goal, const int &length);
75  const dg::Vector &getGoal(void);
76  const int &getLength(void);
77  const int &getStart(void);
78 
79  void setSmoothing(const int &mode, const double &param);
80 
81 public: /* --- PARAMS --- */
82  virtual void display(std::ostream &os) const;
83  void initCommands(void);
84 };
85 
86 } /* namespace sot */
87 } /* namespace dynamicgraph */
88 
89 #endif /* #ifndef __SOT_SMOOTHREACH_H_H */
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
dynamicgraph::sot::SmoothReach::CLASS_NAME
static const std::string CLASS_NAME
Definition: smooth-reach.hh:50
SOTSMOOTHREACH_EXPORT
#define SOTSMOOTHREACH_EXPORT
Definition: smooth-reach.hh:36
dynamicgraph::sot::SmoothReach::getClassName
virtual const std::string & getClassName() const
Definition: smooth-reach.hh:51
dynamicgraph::sot::SmoothReach::goalSOUT
dg::SignalTimeDependent< dg::Vector, int > goalSOUT
Definition: smooth-reach.hh:68
dynamicgraph::sot::SmoothReach
Definition: smooth-reach.hh:48
dynamicgraph::sot::SmoothReach::~SmoothReach
virtual ~SmoothReach(void)
Definition: smooth-reach.hh:64