import upstream maccel baseline
Tests / test_core_function (push) Failing after 12s

This commit is contained in:
2026-03-24 12:10:31 +00:00
parent 6e948d7b39
commit 5f1254d11a
108 changed files with 18930 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#ifndef __ACCEL_NATURAL_H_
#define __ACCEL_NATURAL_H_
#include "../fixedptc.h"
struct natural_curve_args {
fpt decay_rate;
fpt offset;
fpt limit;
};
/**
* Gain Function for Natural Acceleration
*/
static inline fpt __natural_sens_fun(fpt input_speed,
struct natural_curve_args args) {
dbg("natural: decay_rate %s", fptoa(args.decay_rate));
dbg("natural: offset %s", fptoa(args.offset));
dbg("natural: limit %s", fptoa(args.limit));
if (input_speed <= args.offset) {
return FIXEDPT_ONE;
}
if (args.limit <= FIXEDPT_ONE) {
return FIXEDPT_ONE;
}
if (args.decay_rate <= 0) {
return FIXEDPT_ONE;
}
fpt limit = args.limit - FIXEDPT_ONE;
fpt accel = fpt_div(args.decay_rate, fpt_abs(limit));
fpt constant = fpt_div(-limit, accel);
dbg("natural: constant %s", fptoa(constant));
fpt offset_x = args.offset - input_speed;
fpt decay = fpt_exp(fpt_mul(accel, offset_x));
dbg("natural: decay %s", fptoa(decay));
fpt output_denom = fpt_div(decay, accel) - offset_x;
fpt output = fpt_mul(limit, output_denom) + constant;
return fpt_div(output, input_speed) + FIXEDPT_ONE;
}
#endif