Not yet verified on hardware. - shared/HexapodProtocol: CmdPacket (now 20 bytes, adds remote_roll / remote_pitch), FLAG_* bits and radio settings as the single protocol definition; static payload size = sizeof(CmdPacket) on both radios. - robot: use the shared protocol; vx = forward (harness w/x <-> q/e); InputMapper adds remote tilt on top of the right stick when FLAG_REMOTE_GYRO is set, and robot.ino no longer zeroes stick roll/pitch when it's off. - remote (Teensy 4.1): Sticks (calibration, EEPROM), RemoteIMU, RemoteState (interlocks, link-loss disarm, smoothing), PacketBuilder, RadioLink, NextionUI, SerialConsole. - CLAUDE.md, README.md, remote/README.md, remote/NEXTION.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
655 B
C++
22 lines
655 B
C++
#pragma once
|
|
#include <HexapodProtocol.h>
|
|
#include "Sticks.h"
|
|
#include "RemoteIMU.h"
|
|
#include "RemoteState.h"
|
|
|
|
// The inverse of the robot's InputMapper: turns physical stick axes, handset
|
|
// tilt and operator state into a CmdPacket. It only fills fields per the
|
|
// protocol contract (HexapodProtocol.h); all physical scaling and mode
|
|
// interpretation stays on the robot.
|
|
class PacketBuilder {
|
|
public:
|
|
CmdPacket build(const StickFrame& s, const RemoteIMU& imu, const RemoteState& st, uint32_t now_ms);
|
|
|
|
private:
|
|
uint8_t seq_ = 0;
|
|
bool walk_seen_ = false;
|
|
uint32_t last_walk_input_ms_ = 0;
|
|
|
|
static int16_t tiltToWire(float deg, float blend);
|
|
};
|