rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
LuaPid Struct Referencefinal

#include <lua_pid.h>

Collaboration diagram for LuaPid:
Collaboration graph
[legend]

Public Member Functions

 LuaPid ()=default
 
 LuaPid (float kp, float ki, float kd, float min, float max)
 
float get (float target, float input)
 
void setOffset (float offset)
 
void reset ()
 

Private Attributes

Pid m_pid
 
Timer m_lastUpdate
 
pid_s m_params
 

Detailed Description

Definition at line 5 of file lua_pid.h.

Constructor & Destructor Documentation

◆ LuaPid() [1/2]

LuaPid::LuaPid ( )
default

◆ LuaPid() [2/2]

LuaPid::LuaPid ( float  kp,
float  ki,
float  kd,
float  min,
float  max 
)
inline

Member Function Documentation

◆ get()

float LuaPid::get ( float  target,
float  input 
)
inline

Definition at line 27 of file lua_pid.h.

27 {
28#if EFI_UNIT_TEST
29 // this is how we avoid zero dt
30 advanceTimeUs(1000);
31#endif
32
33 float dt = m_lastUpdate.getElapsedSecondsAndReset(getTimeNowNt());
34
35 return m_pid.getOutput(target, input, dt);
36 }
float getOutput(float target, float input)
Definition efi_pid.cpp:56
efitick_t getTimeNowNt()
Definition efitime.cpp:19
void advanceTimeUs(int us)

Referenced by configureRusefiLuaHooks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void LuaPid::reset ( )
inline

Definition at line 43 of file lua_pid.h.

43 {
44 m_pid.reset();
45 }
virtual void reset()
Definition efi_pid.cpp:103

Referenced by configureRusefiLuaHooks(), and setOffset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOffset()

void LuaPid::setOffset ( float  offset)
inline

Definition at line 38 of file lua_pid.h.

38 {
40 reset();
41 }
void reset()
Definition lua_pid.h:43
uint16_t offset
Definition tunerstudio.h:0

Referenced by configureRusefiLuaHooks().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ m_lastUpdate

Timer LuaPid::m_lastUpdate
private

Definition at line 49 of file lua_pid.h.

Referenced by get(), and LuaPid().

◆ m_params

pid_s LuaPid::m_params
private

Definition at line 50 of file lua_pid.h.

Referenced by LuaPid(), and setOffset().

◆ m_pid

Pid LuaPid::m_pid
private

Definition at line 48 of file lua_pid.h.

Referenced by get(), and reset().


The documentation for this struct was generated from the following file: