Initial import: robot firmware + PlatformIO two-env scaffold
Robot-side firmware (Teensy 4.0) imported unchanged as extracted. platformio.ini defines [env:robot] (teensy40) and [env:remote] (teensy41); scripts/select_src_dir.py points each env at its own sketch folder so robot/ and remote/ stay Arduino-style sketches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
ad77b06c36
27 files changed
+1107
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
// Rate-limited setpoint smoother. Every place a discrete command can jump
|
||||
// (body pose axes, gait speed, the sit/stand blend) gets one of these instead
|
||||
// of using the raw commanded value directly.
|
||||
struct SmoothedValue {
|
||||
float current = 0;
|
||||
float target = 0;
|
||||
float max_rate; // units per second
|
||||
|
||||
explicit SmoothedValue(float rate = 100.0f) : max_rate(rate) {}
|
||||
|
||||
void setTarget(float t) { target = t; }
|
||||
|
||||
float update(float dt) {
|
||||
float delta = target - current;
|
||||
float max_step = max_rate * dt;
|
||||
if (delta > max_step) delta = max_step;
|
||||
else if (delta < -max_step) delta = -max_step;
|
||||
current += delta;
|
||||
return current;
|
||||
}
|
||||
|
||||
void reset(float v) { current = target = v; }
|
||||
};
|
||||
Reference in new issue
Block a user