MCPcopy Create free account
hub / github.com/ecto/muni / encodeTool

Function encodeTool

depot/console/src/lib/protocol.ts:147–162  ·  view source on GitHub ↗
(
  axis: number,
  motor: number,
  actionA: boolean,
  actionB: boolean
)

Source from the content-addressed store, hash-verified

145}
146
147export function encodeTool(
148 axis: number,
149 motor: number,
150 actionA: boolean,
151 actionB: boolean
152): ArrayBuffer {
153 // 8 (header) + 4 (axis) + 4 (motor) + 1 (action_a) + 1 (action_b) = 18 bytes
154 const buf = new ArrayBuffer(18);
155 const view = new DataView(buf);
156 buildHeader(view, MSG_TOOL);
157 view.setFloat32(8, axis, true);
158 view.setFloat32(12, motor, true);
159 view.setUint8(16, actionA ? 1 : 0);
160 view.setUint8(17, actionB ? 1 : 0);
161 return buf;
162}
163
164// ============================================================================
165// Telemetry Decoding (Rover -> Operator)

Callers 1

useRoverConnectionRtcFunction · 0.90

Calls 1

buildHeaderFunction · 0.85

Tested by

no test coverage detected