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
5
namespace
subzero
{
6
namespace
InputUtils {
7
typedef
struct
{
8
double
x
;
9
double
y
;
10
bool
deadzoneApplied
;
11
}
DeadzoneAxes
;
12
21
DeadzoneAxes
CalculateCircularDeadzone
(
double
x,
double
y,
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
subzero::InputUtils::CalculateCircularDeadzone
DeadzoneAxes CalculateCircularDeadzone(double x, double y, double deadzoneDistance)
Remaps x/y inputs to a combined value before applying a deadzone.
Definition
InputUtils.h:21
subzero
Definition
AutoFactory.h:20
subzero::InputUtils::DeadzoneAxes
Definition
InputUtils.h:7
subzero::InputUtils::DeadzoneAxes::deadzoneApplied
bool deadzoneApplied
Definition
InputUtils.h:10
subzero::InputUtils::DeadzoneAxes::x
double x
Definition
InputUtils.h:8
subzero::InputUtils::DeadzoneAxes::y
double y
Definition
InputUtils.h:9
include
subzero
utils
InputUtils.h
Generated by
1.11.0