taiyou komazawa
/
Nucleo_fliping_arm
2018 HongoMechaTech A
lib/Timer_PID.cpp@0:e83b840a5f86, 2018-09-18 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Tue Sep 18 03:11:01 2018 +0000
- Revision:
- 0:e83b840a5f86
????????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Komazawa_sun | 0:e83b840a5f86 | 1 | #include "Timer_PID.h" |
Komazawa_sun | 0:e83b840a5f86 | 2 | |
Komazawa_sun | 0:e83b840a5f86 | 3 | Timer_PID::Timer_PID(double kp, double ki, double kd) : PID_Control(kp, ki, kd) |
Komazawa_sun | 0:e83b840a5f86 | 4 | { |
Komazawa_sun | 0:e83b840a5f86 | 5 | reset(); |
Komazawa_sun | 0:e83b840a5f86 | 6 | } |
Komazawa_sun | 0:e83b840a5f86 | 7 | |
Komazawa_sun | 0:e83b840a5f86 | 8 | double Timer_PID::PID(double present, double target) |
Komazawa_sun | 0:e83b840a5f86 | 9 | { |
Komazawa_sun | 0:e83b840a5f86 | 10 | interval = read_interval(); |
Komazawa_sun | 0:e83b840a5f86 | 11 | return PID_Control::PID(present, target, interval); |
Komazawa_sun | 0:e83b840a5f86 | 12 | } |
Komazawa_sun | 0:e83b840a5f86 | 13 | |
Komazawa_sun | 0:e83b840a5f86 | 14 | double Timer_PID::read_interval() |
Komazawa_sun | 0:e83b840a5f86 | 15 | { |
Komazawa_sun | 0:e83b840a5f86 | 16 | double time; |
Komazawa_sun | 0:e83b840a5f86 | 17 | time = timer.read(); |
Komazawa_sun | 0:e83b840a5f86 | 18 | timer.reset(); |
Komazawa_sun | 0:e83b840a5f86 | 19 | return time; |
Komazawa_sun | 0:e83b840a5f86 | 20 | } |
Komazawa_sun | 0:e83b840a5f86 | 21 | |
Komazawa_sun | 0:e83b840a5f86 | 22 | void Timer_PID::reset() |
Komazawa_sun | 0:e83b840a5f86 | 23 | { |
Komazawa_sun | 0:e83b840a5f86 | 24 | PID_Control::reset(); |
Komazawa_sun | 0:e83b840a5f86 | 25 | timer.reset(); |
Komazawa_sun | 0:e83b840a5f86 | 26 | timer.start(); |
Komazawa_sun | 0:e83b840a5f86 | 27 | } |