Files
hexapod-robot/2026-current/robot/InputMapper.h
T
mangavalkandClaude Opus 5.5 ad77b06c36 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>
2026-09-28 15:36:37 +02:00

31 lines
865 B
C++

#pragma once
#include "Comms.h"
#include "GaitEngine.h"
#include "BodyPose.h"
struct MapperOutput {
Twist twist;
PoseCommand pose;
bool armed = false;
bool stand_request = false;
bool walk_active = false;
bool mode_b = false;
bool gait_wave = false;
bool remote_gyro_enabled = false;
bool robot_gyro_enabled = false;
};
class InputMapper {
public:
// heading_deg is the robot's current tracked heading estimate; only mode B uses it.
MapperOutput map(const CmdPacket& p, float heading_deg, float dt);
private:
float heading_target_deg_ = 0;
static constexpr float MAX_TURN_RATE_DEG_S = 90.0f;
static constexpr float HEADING_KP = 2.0f;
static constexpr float MAX_LINEAR_MM_S = 150.0f; // tune to your leg workspace / servo speed
static constexpr float MAX_POSE_OFFSET_MM = 40.0f;
static constexpr float MAX_TILT_DEG = 20.0f;
};