MCU
Loading...
Searching...
No Matches
Utility.h
Go to the documentation of this file.
1#ifndef __UTILITY_H__
2#define __UTILITY_H__
4#include <array>
5// Defines
6const int FL = 0;
7const int FR = 1;
8const int RL = 2;
9const int RR = 3;
10const int NUM_MOTORS = 4;
11
12const int DEBOUNCE_MILLIS = 10; // milliseconds before registering another button press
13
15template <typename T>
16struct veh_vec
17{
18public:
19 T FL;
20 T FR;
21 T RL;
22 T RR;
23
24public:
25 veh_vec() = default;
26 veh_vec(T _FL, T _FR, T _RL, T _RR)
27 {
28 FL = _FL;
29 FR = _FR;
30 RL = _RL;
31 RR = _RR;
32 }
33
35 void copy_to_arr(T (&arr_out)[4])
36 {
37 arr_out[0] = FL;
38 arr_out[1] = FR;
39 arr_out[2] = RL;
40 arr_out[3] = RR;
41 }
42};
43
44template <typename T>
45struct xyz_vec
46{
47 T x;
48 T y;
49 T z;
50};
51
52template <typename T>
53struct xy_vec
54{
55 T x;
56 T y;
57};
58
59#endif /* __UTILITY_H__ */
const int RR
Definition: Utility.h:9
const int FL
Definition: Utility.h:6
const int FR
Definition: Utility.h:7
const int DEBOUNCE_MILLIS
Definition: Utility.h:12
const int RL
Definition: Utility.h:8
const int NUM_MOTORS
Definition: Utility.h:10
generic data vector type that can be used with tire and / or anything to do with 4 corners of the car...
Definition: Utility.h:17
void copy_to_arr(T(&arr_out)[4])
copy values to array in FL, FR, RL, RR order
Definition: Utility.h:35
veh_vec(T _FL, T _FR, T _RL, T _RR)
Definition: Utility.h:26
T FL
Definition: Utility.h:19
T RL
Definition: Utility.h:21
veh_vec()=default
T RR
Definition: Utility.h:22
T FR
Definition: Utility.h:20
Definition: Utility.h:54
T x
Definition: Utility.h:55
T y
Definition: Utility.h:56
T z
Definition: Utility.h:49
T x
Definition: Utility.h:47
T y
Definition: Utility.h:48