-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol_input.cpp
More file actions
36 lines (32 loc) · 811 Bytes
/
control_input.cpp
File metadata and controls
36 lines (32 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* control_input.cpp
*
* Created on: 04-Dec-2014
* Author: niladriisl
*/
#include </usr/include/eigen3/Eigen/Core>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace Eigen;
using namespace std;
Eigen::VectorXf control_input(Eigen::VectorXf input, Eigen::VectorXf Grad_V,
Eigen::VectorXf xi_star, Eigen::VectorXf f_estimate, float rho_0,
float K) {
int input_size = input.rows();
Eigen::VectorXf control_input(input_size);
float tmp_value1 = Grad_V.transpose() * f_estimate
+ rho_0 * (1 - exp(-K * input.norm()));
if (tmp_value1 <= 0 && input == xi_star) {
control_input.Zero(input_size);
}
else if(input == xi_star)
{
control_input = -f_estimate;
}
else
{
control_input = -((tmp_value1)/(Grad_V.transpose()*Grad_V))*Grad_V;
}
return control_input;
}