feat: quaternion relative
This commit is contained in:
@@ -2,7 +2,7 @@ export interface PIDParameters {
|
||||
kP: number;
|
||||
kI: number;
|
||||
kD: number;
|
||||
errorWrap?: (error: number) => number;
|
||||
calculateError?: (setpoint: number, measuredValue: number) => number;
|
||||
}
|
||||
|
||||
export type PIDReport = {
|
||||
@@ -46,10 +46,9 @@ export class PID {
|
||||
public update(measuredValue: number): number {
|
||||
const currentTime = os.epoch("utc");
|
||||
|
||||
const rawError = this.setpoint - measuredValue;
|
||||
const error = this.params.errorWrap
|
||||
? this.params.errorWrap(rawError)
|
||||
: rawError;
|
||||
const error = this.params.calculateError
|
||||
? this.params.calculateError(this.setpoint, measuredValue)
|
||||
: this.setpoint - measuredValue;
|
||||
|
||||
let deltaTime = 0;
|
||||
if (this.lastTime !== null) {
|
||||
|
||||
Reference in New Issue
Block a user