-
Notifications
You must be signed in to change notification settings - Fork 0
/
Constants.h
81 lines (69 loc) · 2.26 KB
/
Constants.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* @file Constants.h
* @author Ryan Johnson ([email protected])
* @brief Adjustable constants for the whole system
* @version 0.1
* @date 2020-07-19
*
* @copyright Copyright (c) 2020
*
*/
#ifndef PIN_MAPPINGS_GUARD_H
#define PIN_MAPPINGS_GUARD_H
#include <Controllino.h>
#define PIN_CAST(pin) static_cast<unsigned char>((pin))
namespace Constants {
namespace Algorithm {
//! The value past which any rotation is not acceptable
constexpr double k_correctTiltAtDegrees = 0.1;
//! The value/deadband which the algorithm should not attempt to correct
//! deviations within
constexpr double k_stopCorrectingTiltAtDegrees = 0.05;
//! The maximum amount of deviation from level before throwing a fault.
//! This is an imporant safeguard against a ram failing to move!
constexpr double k_maximumAllowableTiltRange = 10.0;
//! The alpha for exponentially weighted average smoothing on the inclinometer
//! (higher = less smoothing)
constexpr double k_inclinometerEWMASmoothingAlpha = 0.5;
} // namespace Algorithm
namespace Physical {
//! This value represents the yaw offset of the installed sensor, which cannot
//! be determined automatically.
constexpr double k_inclinometerInstalledYawAdjustment = 0.0;
} // namespace Physical
namespace Pins {
// ========= BUTTON INPUTS ========= //
enum class BUTTON {
ZERO = CONTROLLINO_A0,
REFLASH_ACEINNA = CONTROLLINO_A3,
RAISE = CONTROLLINO_A1,
LOWER = CONTROLLINO_A2,
CLEAR_FAULT = CONTROLLINO_A4
};
// ================================= //
// ======== CONTROL OUTPUTS ======== //
enum class RAM {
RAISE_1 = CONTROLLINO_D1,
LOWER_1 = CONTROLLINO_D0,
RAISE_2 = CONTROLLINO_D3,
LOWER_2 = CONTROLLINO_D2,
RAISE_3 = CONTROLLINO_D5,
LOWER_3 = CONTROLLINO_D4,
RAISE_4 = CONTROLLINO_D7,
LOWER_4 = CONTROLLINO_D6
};
enum class MOTOR {
ENABLE_RAISE = CONTROLLINO_D8,
ENABLE_LOWER = CONTROLLINO_D8
};
// ================================= //
// ======= INDICATOR OUTPUTS ======= //
enum class INDICATOR {
FAULT_ACTIVE = CONTROLLINO_D12,
FAULT_CLEARABLE = CONTROLLINO_D11,
READY = CONTROLLINO_D10
};
// ================================= //
} // namespace Pins
} // namespace Constants
#endif // PIN_MAPPINGS_GUARD_H