disturbance_interface.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_PLANTS_INCLUDE_CORBO_PLANTS_DISTURBANCE_INTERFACE_H_
26 #define SRC_PLANTS_INCLUDE_CORBO_PLANTS_DISTURBANCE_INTERFACE_H_
27 
28 #include <corbo-core/factory.h>
29 #include <corbo-core/time.h>
30 #include <corbo-core/types.h>
31 
32 #ifdef MESSAGE_SUPPORT
33 #include <corbo-communication/messages/plants/disturbance.pb.h>
34 #endif
35 
36 #include <memory>
37 
38 namespace corbo {
39 
40 class DisturbanceInterface
41 {
42  public:
43  using Ptr = std::shared_ptr<DisturbanceInterface>;
44 
46  virtual ~DisturbanceInterface() {}
47 
49  virtual Ptr getInstance() const = 0;
50 
60  virtual void disturb(const Time& t, const Eigen::Ref<const Eigen::VectorXd>& values, Eigen::Ref<Eigen::VectorXd> disturbed_values) = 0;
61 
71  virtual bool checkParameters(int values_dim, std::stringstream* issues) const { return true; }
72 
74  virtual void reset() = 0;
75 
77  static Factory<DisturbanceInterface>& getFactory() { return Factory<DisturbanceInterface>::instance(); }
78 
79 #ifdef MESSAGE_SUPPORT
80  virtual void toMessage(messages::Disturbance& message) const {}
83  virtual void fromMessage(const messages::Disturbance& message, std::stringstream* issues = nullptr) {}
84 #endif
85 };
86 
88 #define FACTORY_REGISTER_DISTURBANCE(type) FACTORY_REGISTER_OBJECT(type, DisturbanceInterface)
89 
90 } // namespace corbo
91 
92 #endif // SRC_PLANTS_INCLUDE_CORBO_PLANTS_DISTURBANCE_INTERFACE_H_
corbo::DisturbanceInterface::getFactory
static Factory< DisturbanceInterface > & getFactory()
Get access to the associated factory.
Definition: disturbance_interface.h:121
factory.h
corbo
Definition: communication/include/corbo-communication/utilities.h:37
corbo::Factory
Generic factory object.
Definition: factory.h:90
corbo::DisturbanceInterface::~DisturbanceInterface
virtual ~DisturbanceInterface()
Virtual destructor.
Definition: disturbance_interface.h:90
corbo::Factory::instance
static Factory & instance()
< Retrieve static instance of the factory
Definition: factory.h:116
corbo::DisturbanceInterface::Ptr
std::shared_ptr< DisturbanceInterface > Ptr
Definition: disturbance_interface.h:87
corbo::DisturbanceInterface::getInstance
virtual Ptr getInstance() const =0
Return a newly created shared instance of the implemented class.
time.h
corbo::DisturbanceInterface::disturb
virtual void disturb(const Time &t, const Eigen::Ref< const Eigen::VectorXd > &values, Eigen::Ref< Eigen::VectorXd > disturbed_values)=0
Modify values according to the underlying disturbance model.
corbo::DisturbanceInterface::reset
virtual void reset()=0
reset internal state
corbo::DisturbanceInterface::checkParameters
virtual bool checkParameters(int values_dim, std::stringstream *issues) const
Check the underlying parameter configuration for validity.
Definition: disturbance_interface.h:115
Eigen::Ref
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:192
types.h


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:05:45