Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
diy
2018-gr2-project-selbstbalancierender-roboter
Commits
65aa92df
Commit
65aa92df
authored
Aug 02, 2018
by
Quirin Apfel
Browse files
regler mit schwellen
parent
596b23bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
HalloRobot/libProject/src/control.c
View file @
65aa92df
...
...
@@ -68,22 +68,30 @@ float pi_control(float e)
*/
float
pid_control
(
float
e
)
{
float
K
=
0
.
8
f
;
float
K
=
0
.
4
f
;
const
float
T_i
=
0
.
1
f
;
//0.18
const
float
T_d
=
0
.
05
;
if
(
e
>
2
||
e
<
-
2
){
K
=
5
.
0
;
const
float
T_d
=
0
.
025
;
float
ee
=
e
;
if
(
e
>
10
.
0
||
e
<
-
10
.
0
){
//K = 2.4;
ee
=
e
*
e
*
e
;
/*if(e<0){
ee = -ee;
}*/
}
if
(
e
>
1
.
5
||
e
<
-
1
.
5
){
K
=
100
.
0
;
}
static
float
e_old
=
0
;
/*
float ee = e*e;
if(e<0){
ee = -ee;
}
sum_error
+=
e
e
/
F_CONTROL
;
*/
sum_error
+=
e
/
F_CONTROL
;
float
derivative
=
(
e
-
e_old
)
*
F_CONTROL
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment