orwell 0.0.0
ParallelController.hxx
1/*
2 Copyright (c) Tobias Löw
3 Written by Tobias Löw <https://tobiloew.ch>
4
5 This file is part of orwell.
6
7 gafro is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3 as
9 published by the Free Software Foundation.
10
11 gafro is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with gafro. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <orwell/ParallelController.hpp>
23
24namespace orwell
25{
26
27 template <int dof, template <int> class DerivedController>
28 ParallelController<dof, DerivedController>::ParallelController(const sackmesser::Interface::Ptr &interface, const std::string &name)
29 : TorqueController<dof>(interface, name), TorqueController<dof>::SharedGroup(interface, name + "/controller")
30 {
31 this->forEach([this](typename TorqueController<dof>::Ptr controller) { controllers_.push_back(controller); });
32 }
33
34 template <int dof, template <int> class DerivedController>
36
37 template <int dof, template <int> class DerivedController>
39 {
40 Eigen::Vector<double, dof> torque = Eigen::Vector<double, dof>::Zero();
41
42 for (const auto &controller : controllers_)
43 {
44 torque += controller->computeCommand();
45 }
46
47 return torque;
48 }
49
50} // namespace orwell
invokes several controllers in parallel and combines their control command
Eigen::Vector< double, dof > computeCommand()
computation of the control command depending
ParallelController(const sackmesser::Interface::Ptr &interface, const std::string &name)
Controller using torque commands.
std::shared_ptr< TorqueController > Ptr
typedef