Skip to content

Commit

Permalink
PID: Add a full reset method
Browse files Browse the repository at this point in the history
  • Loading branch information
WickedShell authored and magicrub committed Oct 17, 2017
1 parent 615f6df commit f8ac4ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/PID/PID.cpp
Expand Up @@ -119,6 +119,11 @@ PID::reset_I()
_pid_info.I = 0;
}

void PID::reset() {
memset(&_pid_info, 0, sizeof(_pid_info));
reset_I();
}

void
PID::load_gains()
{
Expand Down
4 changes: 4 additions & 0 deletions libraries/PID/PID.h
Expand Up @@ -39,6 +39,10 @@ class PID {
///
float get_pid(float error, float scaler = 1.0);

/// Reset the whole PID state
//
void reset();

/// Reset the PID integrator
///
void reset_I();
Expand Down

0 comments on commit f8ac4ef

Please sign in to comment.