environment.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_TASKS_INCLUDE_CORBO_TASKS_ENVIRONMENT_H_
26 #define SRC_TASKS_INCLUDE_CORBO_TASKS_ENVIRONMENT_H_
27 
31 #include <memory>
32 #include <string>
33 
34 namespace corbo {
35 
49 class Environment
50 {
51  public:
52  using Ptr = std::shared_ptr<Environment>;
53 
55  Environment() {}
58 
60  bool hasController() const { return (bool)_controller; }
62  bool hasObserver() const { return (bool)_observer; }
64  bool hasPlant() const { return (bool)_plant; }
65 
67  const ControllerInterface::Ptr& getController() const { return _controller; }
71  const ObserverInterface::Ptr& getObserver() const { return _observer; }
75  const PlantInterface::Ptr& getPlant() const { return _plant; }
78 
80  void setController(ControllerInterface::Ptr controller);
82  void setObserver(ObserverInterface::Ptr observer);
84  void setPlant(PlantInterface::Ptr plant);
85 
95  bool verify(std::string* msg = nullptr) const;
96 
98  void reset();
99 
100  private:
104 };
105 
106 } // namespace corbo
107 
108 #endif // SRC_TASKS_INCLUDE_CORBO_TASKS_ENVIRONMENT_H_
corbo::Environment::getObserver
const ObserverInterface::Ptr & getObserver() const
Read access to the underlying observer.
Definition: environment.h:115
corbo::Environment::setPlant
void setPlant(PlantInterface::Ptr plant)
Set plant.
Definition: environment.cpp:66
corbo
Definition: communication/include/corbo-communication/utilities.h:37
corbo::Environment::Environment
Environment()
Default constructor.
Definition: environment.h:99
corbo::Environment::reset
void reset()
Reset environment.
Definition: environment.cpp:178
corbo::Environment::hasController
bool hasController() const
Check if a controller has been specified.
Definition: environment.h:104
corbo::Environment::_controller
ControllerInterface::Ptr _controller
Definition: environment.h:145
corbo::Environment::getControllerPtr
ControllerInterface::Ptr getControllerPtr()
Write access to the underlying controller.
Definition: environment.h:113
corbo::Environment::setController
void setController(ControllerInterface::Ptr controller)
Set controller.
Definition: environment.cpp:62
corbo::Environment::_plant
PlantInterface::Ptr _plant
Definition: environment.h:147
corbo::Environment::getPlant
const PlantInterface::Ptr & getPlant() const
Read access to the underlying plant.
Definition: environment.h:119
controller_interface.h
corbo::ObserverInterface::Ptr
std::shared_ptr< ObserverInterface > Ptr
Definition: observer_interface.h:105
corbo::Environment::Ptr
std::shared_ptr< Environment > Ptr
Definition: environment.h:96
corbo::Environment::_observer
ObserverInterface::Ptr _observer
Definition: environment.h:146
corbo::ControllerInterface::Ptr
std::shared_ptr< ControllerInterface > Ptr
Definition: controller_interface.h:105
plant_interface.h
corbo::Environment::setObserver
void setObserver(ObserverInterface::Ptr observer)
Set observer.
Definition: environment.cpp:64
corbo::Environment::hasObserver
bool hasObserver() const
Check if an observer has been specified.
Definition: environment.h:106
corbo::Environment::getObserverPtr
ObserverInterface::Ptr getObserverPtr()
Write access to the underlying observer.
Definition: environment.h:117
corbo::Environment::getPlantPtr
PlantInterface::Ptr getPlantPtr()
Write access to the underlying plant.
Definition: environment.h:121
corbo::Environment::getController
const ControllerInterface::Ptr & getController() const
Read access to the underlying controller.
Definition: environment.h:111
corbo::Environment::hasPlant
bool hasPlant() const
Check if a plant has been specified.
Definition: environment.h:108
corbo::Environment::verify
bool verify(std::string *msg=nullptr) const
Check if the environment satisfies all requirements (dimensions, ...)
Definition: environment.cpp:68
observer_interface.h
corbo::PlantInterface::Ptr
std::shared_ptr< PlantInterface > Ptr
Definition: plant_interface.h:101


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