Skip to content
Snippets Groups Projects
control-gr.hh 2.31 KiB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
/*
 * Copyright 2010,
 * François Bleibel,
 * Olivier Stasse,
 *
 * CNRS/AIST
 *
 */

#ifndef __SOT_Control_GR_HH__
#define __SOT_Control_GR_HH__

/* --------------------------------------------------------------------- */
/* --- INCLUDE --------------------------------------------------------- */
/* --------------------------------------------------------------------- */

/* Matrix */
#include <dynamic-graph/linear-algebra.h>

/* SOT */
#include <dynamic-graph/entity.h>
Guilhem Saurel's avatar
Guilhem Saurel committed
#include <dynamic-graph/signal-ptr.h>
#include <dynamic-graph/signal-time-dependent.h>

/* --------------------------------------------------------------------- */
/* --- API ------------------------------------------------------------- */
/* --------------------------------------------------------------------- */

Guilhem Saurel's avatar
Guilhem Saurel committed
#if defined(WIN32)
#if defined(control_gr_EXPORTS)
#define ControlGR_EXPORT __declspec(dllexport)
#else
#define ControlGR_EXPORT __declspec(dllimport)
#endif
Guilhem Saurel's avatar
Guilhem Saurel committed
#define ControlGR_EXPORT
namespace dynamicgraph {
Guilhem Saurel's avatar
Guilhem Saurel committed
namespace sot {
Guilhem Saurel's avatar
Guilhem Saurel committed
/* --------------------------------------------------------------------- */
/* --- CLASS ----------------------------------------------------------- */
/* --------------------------------------------------------------------- */
Guilhem Saurel's avatar
Guilhem Saurel committed
class ControlGR_EXPORT ControlGR : public Entity {
Guilhem Saurel's avatar
Guilhem Saurel committed
 public: /* --- CONSTRUCTOR ---- */
Guilhem Saurel's avatar
Guilhem Saurel committed
  ControlGR(const std::string &name);
Guilhem Saurel's avatar
Guilhem Saurel committed
 public: /* --- INIT --- */
Guilhem Saurel's avatar
Guilhem Saurel committed
  void init(const double &step);
Guilhem Saurel's avatar
Guilhem Saurel committed
 public: /* --- CONSTANTS --- */
Guilhem Saurel's avatar
Guilhem Saurel committed
  /* Default values. */
Guilhem Saurel's avatar
Guilhem Saurel committed
  static const double TIME_STEP_DEFAULT;  // = 0.001
Guilhem Saurel's avatar
Guilhem Saurel committed
 public: /* --- ENTITY INHERITANCE --- */
Guilhem Saurel's avatar
Guilhem Saurel committed
  static const std::string CLASS_NAME;
  virtual void display(std::ostream &os) const;
  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
Guilhem Saurel's avatar
Guilhem Saurel committed
 protected:
Guilhem Saurel's avatar
Guilhem Saurel committed
  /* Parameters of the torque-control function:
   * tau = - A*qddot = g */
  double TimeStep;
  double _dimension;
Guilhem Saurel's avatar
Guilhem Saurel committed
 public: /* --- SIGNALS --- */
Olivier Stasse's avatar
Olivier Stasse committed
  SignalPtr<dynamicgraph::Matrix, int> matrixASIN;
  SignalPtr<dynamicgraph::Vector, int> accelerationSIN;
  SignalPtr<dynamicgraph::Vector, int> gravitySIN;
  SignalTimeDependent<dynamicgraph::Vector, int> controlSOUT;
Guilhem Saurel's avatar
Guilhem Saurel committed
 protected:
Guilhem Saurel's avatar
Guilhem Saurel committed
  double &setsize(int dimension);
Olivier Stasse's avatar
Olivier Stasse committed
  dynamicgraph::Vector &computeControl(dynamicgraph::Vector &tau, int t);
Guilhem Saurel's avatar
Guilhem Saurel committed
};
Guilhem Saurel's avatar
Guilhem Saurel committed
}  // namespace sot
}  // namespace dynamicgraph
Guilhem Saurel's avatar
Guilhem Saurel committed
#endif  // #ifndef __SOT_Control_GR_HH__