-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.h
275 lines (245 loc) · 6.64 KB
/
config.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/**
* @file config.h
* @author Timarrr (tigrmango@gmail.com)
* @brief ROV config
* @version 0.1
* @date 2023-03-31
*
* @copyright Copyright (c) 2023
*
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "api/Common.h"
#include <Arduino.h>
#include <cstdint>
/**
* @brief Config namespace, responsible for the ROV's loadout and pinout
*
*/
namespace config {
/**
* @brief Network sub-namespace, responsible for IPs and ports of ROV and RC
*
*/
namespace net {
/**
* @brief ROV's IP address in an array
*
*/
constexpr PROGMEM uint8_t rovIP[4] = {192, 168, 1, 5};
/**
* @brief ROV's port
*
*/
constexpr PROGMEM uint16_t rovPort = 46175;
/**
* @brief RC's IP address in an array
*
*/
constexpr PROGMEM uint8_t rcIP[4] = {192, 168, 1, 4};
/**
* @brief RC's port
*
*/
constexpr PROGMEM uint16_t rcPort = 46176;
/**
* @brief CS pin for the W5xxx network controller
*
*/
constexpr PROGMEM uint8_t netControllerCsPin =
43; // W5500 CS on PA13 pin
} // namespace net
/**
* @brief Pins and various settings of the sensors subsystem
*
*/
namespace sensors {
/**
* @brief Pin of the analog ammeter
*
*/
constexpr PROGMEM pin_size_t ammeter_pin = A0;
/**
* @brief Pin of the analog voltmeter
*
*/
constexpr PROGMEM pin_size_t voltmeter_pin = A1;
/**
* @brief Adjusting constant for the ammeter
*
*/
constexpr PROGMEM float amperage_multiplier = 0.077821;
/**
* @brief Adjusting constant for the voltmeter
*
*/
constexpr PROGMEM float voltage_multiplier = 0.016064;
/**
* @brief Another adjusting constant for the ammeter
*
*/
constexpr PROGMEM int amperage_deflection = 512;
} // namespace sensors
/**
* @brief Manipulator channels' settings
*
*/
namespace manipulator {
/**
* @brief Manipulator grabbing channel
*
*/
constexpr PROGMEM uint8_t manip_grab_ch = 0;
/**
* @brief Manipulator releasing channel
*
*/
constexpr PROGMEM uint8_t manip_release_ch = 1;
/**
* @brief Manipulator CCW rotation channel
*
*/
constexpr PROGMEM uint8_t manip_left_ch = 2;
/**
* @brief Manipulator CW rotation channel
*
*/
constexpr PROGMEM uint8_t manip_right_ch = 3;
} // namespace manipulator
/**
* @brief Cameras' subsystem pins
*
*/
namespace cameras {
/**
* @brief Multiplexer pin
*
*/
constexpr PROGMEM pin_size_t multiplexer_pin = 10;
/**
* @brief Servos' pins
*
*/
enum servos { front = A4, back = A5 };
} // namespace cameras
/**
* @brief Thrusters' subsystem pinout
*
*/
namespace thrusters {
/**
* @brief Enum of thrusters
*/
enum thrusters {
fr_lo_le = 9,
fr_lo_ri = 3,
fr_hi_le = 5,
fr_hi_ri = 2,
ba_lo_le = 7,
ba_lo_ri = 4,
ba_hi_le = 8,
ba_hi_ri = 6,
};
/**
* \brief Thruster directions. Thrusters' values are multiplied by these
* in Thrusters::update
*/
constexpr static int8_t thrusterDirections[8] = {1, -1, -1, 1,
-1, 1, -1, 1};
} // namespace thrusters
/**
* @brief Serial debug connection config
* @todo Implement connection detection proprely
*/
namespace serial {
/**
* @brief Does the ROV wait for SerialUSB connection to PC?
*
*/
constexpr PROGMEM bool waitForSerial = true;
/**
* @brief If waitForSerial == true, then for how much does the ROV need
* to wait for the serial connection?
*
*/
constexpr uint16_t waitForSerialTime = 5000; // ms
} // namespace serial
/**
* @brief Launch configuration loadout
*
*/
namespace launchConfig {
/**
* @brief Configuration enum
* @todo Explain how this works
*/
enum launchConfig {
//
full = 0b0000000000000001,
fast = 0b0000000000000010,
standalone = 0b1000000000000000,
forceEthernet = 0b0100000000000000,
forceNoEthernet = 0b0010000000000000,
forceDepth = 0b0001000000000000,
forceNoDepth = 0b0000100000000000,
forceNoRegulators = 0b0000010000000000,
forceThrusterTest = 0b0000001000000000,
// clang-format on
initEthernet = full | fast | forceEthernet,
initDepth = full | fast | forceDepth
};
/**
* @brief Current selected configuration loadout
*
*/
constexpr PROGMEM launchConfig currentConfig = launchConfig(fast);
} // namespace launchConfig
/**
* @brief Regulators' coefficients
*
*/
namespace regulators {
/**
* @brief Depth regulator proportional coefficient
*
*/
constexpr PROGMEM float depth_p = 200;
/**
* @brief Depth regulator differential coefficient
*
*/
constexpr PROGMEM float depth_d = 10000;
/**
* @brief Yaw regulator proportional coefficient
*
*/
constexpr PROGMEM float yaw_p = 1;
/**
* @brief Yaw regulator differential coefficient
*
*/
constexpr PROGMEM float yaw_d = 100;
/**
* @brief Roll regulator proportional coefficient
*
*/
constexpr PROGMEM float roll_p = 1;
/**
* @brief Roll regulator differential coefficient
*
*/
constexpr PROGMEM float roll_d = 1;
/**
* @brief Pitch regulator proportional coefficient
*
*/
constexpr PROGMEM float pitch_p = 1;
/**
* @brief Pitch regulator differential coefficient
*
*/
constexpr PROGMEM float pitch_d = 1;
} // namespace regulators
} // namespace config
#endif