15 lines
611 B
C++
15 lines
611 B
C++
#pragma once
|
|||
|
|
#include "Kinematics.h"
|
||
|
|
|
||
|
|
class Limits {
|
||
|
|
public:
|
||
|
|
// Clamps a foot target into a conservative safe envelope around the leg's neutral stance.
|
||
|
|
static FootTarget clampWorkspace(int leg_index, const FootTarget& target);
|
||
|
|
|
||
|
|
// Rate-limits a joint angle change to the servo's real max speed.
|
||
|
|
static float clampJointRate(float current_deg, float target_deg, float max_deg_per_sec, float dt);
|
||
|
|
|
||
|
|
// Coarse safety check: are enough legs grounded right now to be stable.
|
||
|
|
// A real support-polygon/center-of-mass check is a good later upgrade.
|
||
|
|
static bool stancePolygonOk(const bool in_stance[6]);
|
||
|
|
};
|