21 lines
655 B
C++
21 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);
|
||
|
|
};
|