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 
50 {
51  public:
52  using Ptr = std::shared_ptr<Environment>;
53 
58 
60  bool hasController() const { return (bool)_controller; }
62  bool hasObserver() const { return (bool)_observer; }
64  bool hasPlant() const { return (bool)_plant; }
65 
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_
bool hasController() const
Check if a controller has been specified.
Definition: environment.h:60
Standard environment for control tasks.
Definition: environment.h:49
ObserverInterface::Ptr getObserverPtr()
Write access to the underlying observer.
Definition: environment.h:73
ControllerInterface::Ptr getControllerPtr()
Write access to the underlying controller.
Definition: environment.h:69
void setObserver(ObserverInterface::Ptr observer)
Set observer.
Definition: environment.cpp:42
void setController(ControllerInterface::Ptr controller)
Set controller.
Definition: environment.cpp:40
bool hasObserver() const
Check if an observer has been specified.
Definition: environment.h:62
std::shared_ptr< Environment > Ptr
Definition: environment.h:52
void setPlant(PlantInterface::Ptr plant)
Set plant.
Definition: environment.cpp:44
const PlantInterface::Ptr & getPlant() const
Read access to the underlying plant.
Definition: environment.h:75
Environment()
Default constructor.
Definition: environment.h:55
bool verify(std::string *msg=nullptr) const
Check if the environment satisfies all requirements (dimensions, ...)
Definition: environment.cpp:46
void reset()
Reset environment.
std::shared_ptr< ObserverInterface > Ptr
const ObserverInterface::Ptr & getObserver() const
Read access to the underlying observer.
Definition: environment.h:71
bool hasPlant() const
Check if a plant has been specified.
Definition: environment.h:64
std::shared_ptr< PlantInterface > Ptr
PlantInterface::Ptr getPlantPtr()
Write access to the underlying plant.
Definition: environment.h:77
ControllerInterface::Ptr _controller
Definition: environment.h:101
const ControllerInterface::Ptr & getController() const
Read access to the underlying controller.
Definition: environment.h:67
PlantInterface::Ptr _plant
Definition: environment.h:103
std::shared_ptr< ControllerInterface > Ptr
ObserverInterface::Ptr _observer
Definition: environment.h:102


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:06:51