SubZero Common
Common library components for an FRC CommandRobot
Loading...
Searching...
No Matches
InputUtils.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4
5namespace subzero {
6namespace InputUtils {
7typedef struct {
8 double x;
9 double y;
12
22 double deadzoneDistance) {
23 if (std::hypot(x, y) > deadzoneDistance) {
24 return {.x = x, .y = y, .deadzoneApplied = false};
25 }
26
27 return {.x = 0, .y = 0, .deadzoneApplied = true};
28}
29} // namespace InputUtils
30} // namespace subzero
DeadzoneAxes CalculateCircularDeadzone(double x, double y, double deadzoneDistance)
Remaps x/y inputs to a combined value before applying a deadzone.
Definition InputUtils.h:21