@@ -34,6 +34,7 @@ DO NOT FLASH TO TEENSY OR TO ARDUINO
34
34
#define VBAT2_SENSE 23
35
35
36
36
// defines 8 thursters for initialization in an array
37
+ // should be replaced with definitions from ROS
37
38
#define SRG_P 0
38
39
#define SRG_S 1
39
40
#define SWY_BW 2
@@ -47,8 +48,11 @@ DO NOT FLASH TO TEENSY OR TO ARDUINO
47
48
Servo thrusters[8 ];
48
49
49
50
// signals to push to thrusters
50
- uint16_t microseconds[] = {1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 };
51
- const uint16_t offCommand[] = {1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 };
51
+ uint16_t microseconds[] = {1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 };
52
+ const uint16_t offCommand[] = {1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 , 1500 };
53
+
54
+ // creates array for 8 thruster currents
55
+ float currents[8 ];
52
56
53
57
// updates thrusters' pwm signals from array
54
58
void updateThrusters (const uint16_t microseconds[8 ]) {
@@ -94,6 +98,17 @@ void waterInterrupt() {
94
98
while (true ) {}
95
99
}
96
100
101
+ void senseCurrent (float currents[]) {
102
+ currents[0 ] = ((analogRead (TC_1) * 3.3 ) / 1023 ) / 0.005 ;
103
+ currents[1 ] = ((analogRead (TC_2) * 3.3 ) / 1023 ) / 0.005 ;
104
+ currents[2 ] = ((analogRead (TC_3) * 3.3 ) / 1023 ) / 0.005 ;
105
+ currents[3 ] = ((analogRead (TC_4) * 3.3 ) / 1023 ) / 0.005 ;
106
+ currents[4 ] = ((analogRead (TC_5) * 3.3 ) / 1023 ) / 0.005 ;
107
+ currents[5 ] = ((analogRead (TC_6) * 3.3 ) / 1023 ) / 0.005 ;
108
+ currents[6 ] = ((analogRead (TC_7) * 3.3 ) / 1023 ) / 0.005 ;
109
+ currents[7 ] = ((analogRead (TC_8) * 3.3 ) / 1023 ) / 0.005 ;
110
+ }
111
+
97
112
void setup () {
98
113
// pinMode(WATER_DETECTED, INPUT_PULLUP);
99
114
// pinMode(MCU_KS, OUTPUT);
0 commit comments