Torque.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // control
8 
9 
11 {
12 
13  class TorqueControllerConfiguration;
14  using TorqueControllerConfigurationPtr = std::shared_ptr<class TorqueControllerConfiguration>;
15 
16 
18  {
19  public:
23  bool limitless,
24  float jointLimitLow,
25  float jointLimitHigh);
30  double pid_max_value;
31  double pid_min_value;
32  double pid_dis;
33  double Kd;
34  double inertia;
35  double scalePI;
36  double scaleTorque;
37  double maxTorque;
38  // double torqueToCurrent = 0.0; // for joint limit avoidance
40  bool limitless = true;
41  double jointLimitHigh = 0.0, jointLimitLow = 0.0;
42  std::vector<float> firFilterImpulseResponse;
43  };
44 
45 
46  class TorquePID
47  {
48  public:
49  TorquePID();
50  void zeroize();
51  void findAcc(double Vel, double dt);
52  void update(double curr_error, double dt);
53  void updatePhi(double curr_pos_error, double dt);
54  void AbsVel(double curr_angle_err, double dt);
55  //void define_pid(PID* pid);
56  double windup_guard = 0;
57  double proportional_gain = 0;
58  double integral_gain = 0;
59  double derivative_gain = 0;
60  double prev_error = 0;
61  double prev_prev_error = 0;
62  double int_error = 0;
63  double control = 0;
64  double max_value = 0;
65  double min_value = 0;
66  double phi = 0;
67  double old_pos = 0;
68  double dis = 0;
69  double abs_vel = 0;
70  double prev_angle = 0;
71  double if_angle = 0;
72  double angle_offset = 0;
73  double CurrError = 0;
74  double SollMoment = 0;
75  double ii = 0;
76  double prev_vel = 0;
77  double acc = 0;
78  double Kd = 0;
79  double inertia = 0;
80  double scalePI = 0;
81  double scaleTorque = 0;
82  double maxTorque = 0;
84  bool status = false;
85  };
86 
87 
89  {
90  public:
91  TorqueController(const TorqueControllerConfigurationPtr& torqueConfigData);
92  float update(const IceUtil::Time& timeSinceLastIteration,
93  const std::string& jointName,
94  float gravity,
95  float actualTorque,
96  float targetTorque,
97  float actualVelocity,
98  float actualPosition);
100  double calcJointLimitProtectionTorque(float actualPosition);
101 
102  private:
103  TorquePID pid;
107  };
108 
109 } // namespace armarx::control::joint_controller
armarx::control::joint_controller::TorquePID::scaleTorque
double scaleTorque
Definition: Torque.h:81
armarx::control::joint_controller::TorquePID::old_pos
double old_pos
Definition: Torque.h:67
armarx::control::joint_controller::TorqueControllerConfiguration::jointLimitLow
double jointLimitLow
Definition: Torque.h:41
armarx::control::joint_controller::TorquePID::SollMoment
double SollMoment
Definition: Torque.h:74
armarx::control::rt_filters::RtAverageFilter
Definition: AverageFilter.h:13
armarx::control::joint_controller::TorquePID::min_value
double min_value
Definition: Torque.h:65
armarx::control::joint_controller::TorquePID::update
void update(double curr_error, double dt)
Definition: Torque.cpp:67
armarx::control::joint_controller::TorquePID::updatePhi
void updatePhi(double curr_pos_error, double dt)
armarx::control::joint_controller::TorquePID::integral_gain
double integral_gain
Definition: Torque.h:58
armarx::control::joint_controller::TorqueControllerConfiguration::pid_derivative_gain
double pid_derivative_gain
Definition: Torque.h:28
armarx::control::joint_controller::TorquePID::windup_guard
double windup_guard
Definition: Torque.h:56
armarx::control::joint_controller::TorquePID::if_angle
double if_angle
Definition: Torque.h:71
armarx::control::joint_controller::TorquePID::derivative_gain
double derivative_gain
Definition: Torque.h:59
armarx::control::joint_controller::TorqueControllerConfiguration::CreateTorqueConfigData
static TorqueControllerConfigurationPtr CreateTorqueConfigData(hardware_config::Config &config, bool limitless, float jointLimitLow, float jointLimitHigh)
Definition: Torque.cpp:94
armarx::control::joint_controller::TorqueController::TorqueController
TorqueController(const TorqueControllerConfigurationPtr &torqueConfigData)
Definition: Torque.cpp:11
armarx::control::joint_controller::TorquePID::ii
double ii
Definition: Torque.h:75
FirFilter.h
armarx::control::joint_controller::TorquePID::prev_vel
double prev_vel
Definition: Torque.h:76
armarx::control::joint_controller::TorquePID::prev_angle
double prev_angle
Definition: Torque.h:70
armarx::control::joint_controller::TorqueControllerConfiguration::scalePI
double scalePI
Definition: Torque.h:35
armarx::control::joint_controller::TorqueControllerConfiguration::Kd
double Kd
Definition: Torque.h:33
ControllerConfiguration.h
armarx::control::joint_controller::TorquePID
Definition: Torque.h:46
armarx::control::joint_controller::TorquePID::prev_error
double prev_error
Definition: Torque.h:60
armarx::control::joint_controller::TorqueController::update
float update(const IceUtil::Time &timeSinceLastIteration, const std::string &jointName, float gravity, float actualTorque, float targetTorque, float actualVelocity, float actualPosition)
Definition: Torque.cpp:134
armarx::control::joint_controller::TorquePID::prev_prev_error
double prev_prev_error
Definition: Torque.h:61
armarx::control::joint_controller::TorquePID::AbsVel
void AbsVel(double curr_angle_err, double dt)
armarx::control::joint_controller::TorquePID::acc
double acc
Definition: Torque.h:77
armarx::control::joint_controller::TorqueControllerConfiguration::TorqueControllerConfiguration
TorqueControllerConfiguration()
Definition: Torque.cpp:128
armarx::control::joint_controller::TorquePID::scalePI
double scalePI
Definition: Torque.h:80
armarx::control::joint_controller::TorquePID::TorquePID
TorquePID()
Definition: Torque.cpp:38
armarx::control::joint_controller::TorqueControllerConfiguration::pid_min_value
double pid_min_value
Definition: Torque.h:31
armarx::control::joint_controller::TorqueController
Definition: Torque.h:88
armarx::control::joint_controller::TorqueControllerConfigurationPtr
std::shared_ptr< class TorqueControllerConfiguration > TorqueControllerConfigurationPtr
Definition: Torque.h:14
armarx::status
status
Definition: FiniteStateMachine.h:259
armarx::control::joint_controller::TorquePID::Kd
double Kd
Definition: Torque.h:78
armarx::control::joint_controller::TorqueControllerConfiguration::jointLimitHigh
double jointLimitHigh
Definition: Torque.h:41
armarx::control::joint_controller::TorqueControllerConfiguration::pid_integral_gain
double pid_integral_gain
Definition: Torque.h:27
armarx::control::joint_controller::TorqueControllerConfiguration::pid_dis
double pid_dis
Definition: Torque.h:32
armarx::control::joint_controller::TorqueController::getFilter
const armarx::control::rt_filters::FirFilter & getFilter() const
Definition: Torque.cpp:232
armarx::control::joint_controller::TorquePID::findAcc
void findAcc(double Vel, double dt)
Definition: Torque.cpp:59
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::joint_controller::TorqueController::calcJointLimitProtectionTorque
double calcJointLimitProtectionTorque(float actualPosition)
Definition: Torque.cpp:205
armarx::control::joint_controller::TorqueControllerConfiguration::maxTorque
double maxTorque
Definition: Torque.h:37
armarx::control::joint_controller::TorquePID::max_value
double max_value
Definition: Torque.h:64
armarx::control::joint_controller::TorquePID::zeroize
void zeroize()
Definition: Torque.cpp:45
armarx::control::joint_controller::TorquePID::inertia
double inertia
Definition: Torque.h:79
armarx::control::joint_controller::TorquePID::angle_offset
double angle_offset
Definition: Torque.h:72
armarx::control::joint_controller::TorquePID::maxTorque
double maxTorque
Definition: Torque.h:82
armarx::control::joint_controller::TorqueControllerConfiguration
Definition: Torque.h:17
armarx::control::joint_controller::TorqueControllerConfiguration::actuatorType
int actuatorType
Definition: Torque.h:39
armarx::control::joint_controller
Definition: ControllerConfiguration.cpp:3
AverageFilter.h
armarx::control::hardware_config::Config
The Config class is the base class of all specialized configurations that have a direct key -> value ...
Definition: Config.h:91
armarx::control::joint_controller::TorquePID::phi
double phi
Definition: Torque.h:66
armarx::control::joint_controller::TorqueControllerConfiguration::inertia
double inertia
Definition: Torque.h:34
armarx::control::joint_controller::TorquePID::CurrError
double CurrError
Definition: Torque.h:73
armarx::control::joint_controller::TorqueControllerConfiguration::pid_windup_guard
double pid_windup_guard
Definition: Torque.h:29
armarx::control::joint_controller::TorquePID::proportional_gain
double proportional_gain
Definition: Torque.h:57
armarx::control::joint_controller::TorquePID::actuatorType
int actuatorType
Definition: Torque.h:83
armarx::control::joint_controller::TorqueControllerConfiguration::scaleTorque
double scaleTorque
Definition: Torque.h:36
armarx::control::joint_controller::TorqueControllerConfiguration::limitless
bool limitless
Definition: Torque.h:40
armarx::control::joint_controller::TorqueControllerConfiguration::pid_max_value
double pid_max_value
Definition: Torque.h:30
control
This file is part of ArmarX.
armarx::control::joint_controller::TorquePID::abs_vel
double abs_vel
Definition: Torque.h:69
armarx::control::joint_controller::TorquePID::dis
double dis
Definition: Torque.h:68
armarx::control::joint_controller::TorquePID::int_error
double int_error
Definition: Torque.h:62
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
armarx::control::rt_filters::FirFilter
Definition: FirFilter.h:38
armarx::control::joint_controller::TorqueControllerConfiguration::pid_proportional_gain
double pid_proportional_gain
Definition: Torque.h:26
armarx::control::joint_controller::TorqueControllerConfiguration::firFilterImpulseResponse
std::vector< float > firFilterImpulseResponse
Definition: Torque.h:42