VelocityManipulatingTorque.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX
19 * @author Mirko Waechter( mirko.waechter at kit dot edu)
20 * @date 2018
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28
29// STD/STL
30#include <cmath>
31
32// armarx
34
36
37// control
40
42{
44 std::shared_ptr<class VelocityManipulatingTorqueControllerConfiguration>;
45
47 {
48 public:
52 bool limitless,
53 float jointLimitLow,
54 float jointLimitHigh);
58 double pid_max_value = 1.0;
59 double accelerationGain = 0.1;
60 double deadZone = 0.1;
61 double decay = 0.99;
62 double maxVelocity = 3.0;
63 double maxAcceleration = 10.0;
64 double maxJerk = 500.0;
65 double torqueToCurrent = 0.0;
66 double maxTargetTorque = 10.0;
67 bool limitless = true;
68 double jointLimitHigh = 0.0, jointLimitLow = 0.0;
69 double pushbackMargin = 5.0 / 180. * M_PI;
70 double pushBackTorque = 100;
71 std::vector<float> firFilterImpulseResponse;
72 };
73
75 {
76 public:
79 float update(const IceUtil::Time& sensorValuesTimestamp,
80 const IceUtil::Time& timeSinceLastIteration,
81 float gravity,
82 float actualTorque,
83 float targetTorque,
84 float actualVelocity,
85 float actualPosition);
86 void reset();
87
88
89 double getCurrentTargetVelocity() const;
90
91 // const VelocityManipulatingTorqueControllerConfigurationPtr& getTorqueConfigData() const;
93
95 const PIDController& getPid();
96 double getLastAcceleration() const;
97
98 double getLastJerk() const;
99
100 protected:
101 double calcJointLimitProtectionTorque(float actualPosition);
102
103 private:
104 PIDController pid;
105 PIDController pidTargetTorque;
106 std::mutex pidParameterMutex;
107 armarx::rtfilters::GaussianFilter torqueGaussianFilter;
108 armarx::control::rt_filters::RtMedianFilter torqueMedianFilter, actualVelocityFilter;
110 double currentTargetVelocity = 0.0;
111 double lastAcceleration = 0.0;
112 double lastJerk = 0.0;
113 };
114
115} // namespace armarx::control::joint_controller
#define M_PI
Definition MathTools.h:17
The Config class is the base class of all specialized configurations that have a direct key -> value ...
Definition Config.h:94
static VelocityManipulatingTorqueControllerConfigurationPtr CreateTorqueConfigData(hardware_config::Config &config, bool limitless, float jointLimitLow, float jointLimitHigh)
float update(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration, float gravity, float actualTorque, float targetTorque, float actualVelocity, float actualPosition)
VelocityManipulatingTorqueController(const VelocityManipulatingTorqueControllerConfigurationPtr &torqueConfigData)
bool setTorqueConfigData(VelocityManipulatingTorqueControllerConfiguration configData)
VelocityManipulatingTorqueControllerConfiguration getTorqueConfigData() const
std::shared_ptr< class VelocityManipulatingTorqueControllerConfiguration > VelocityManipulatingTorqueControllerConfigurationPtr