Skip to content

Commit 3b705d1

Browse files
add data graphs
1 parent b74a676 commit 3b705d1

31 files changed

+2843
-173
lines changed

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/Software_Opstelling/links_met_duim.csv

+556
Large diffs are not rendered by default.

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/Software_Opstelling/links_zonder_duim.csv

+556
Large diffs are not rendered by default.

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/Software_Opstelling/rechts_met_duim.csv

+556
Large diffs are not rendered by default.

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/Software_Opstelling/rechts_snel_met_duim.csv

+556
Large diffs are not rendered by default.

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/Software_Opstelling/rechts_zonder_duim.csv

+556
Large diffs are not rendered by default.

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/showDataCSV.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from csv import reader
33
import matplotlib.pyplot as plt
44

5-
fileName = "data_2022-05-09_112718"
5+
fileName = "links_zonder_duim"
66

7-
file = open("logs/" + fileName + ".csv", 'r', newline='')
7+
file = open("Software_Opstelling/" + fileName + ".csv", 'r', newline='')
88

99
data = reader(file, delimiter=',')
1010

Code PlatformIO/Gesture Control PCBV0.3_F302RET6/python/storeDataCVS.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import serial
55

66
try:
7-
_1Measurement = 18
8-
amountReadings = 1000
7+
_1Measurement = 20
8+
amountReadings = 500
99

1010
#instelling seriële communicatie met poort: COM6 en baudrate: 115200
1111
ser = serial.Serial("COM6",115200)
@@ -64,11 +64,11 @@
6464

6565
#print(testData)
6666
#maak de timestamp
67-
timestamp = f"{date.today()}_{datetime.now().hour}{datetime.now().minute}{datetime.now().second}"
67+
timestamp = f"{date.today()}{datetime.now().hour}{datetime.now().minute}{datetime.now().second}"
6868
##print(timestamp)
6969

7070
#open (maak) het bestand
71-
file = open(("logs/data_"+timestamp+ ".csv"), 'w', newline='')
71+
file = open(("Software_Opstelling/"+timestamp+ ".csv"), 'w', newline='')
7272

7373
#kopel het bestand aan de cvs schrijver
7474
schrijf = writer(file)

Code PlatformIO/Gesture Control Testing Setup/include/main.h

+12-39
Original file line numberDiff line numberDiff line change
@@ -30,55 +30,28 @@ extern "C"
3030
/* Includes ------------------------------------------------------------------*/
3131
#include "stm32f3xx_hal.h"
3232

33-
/* Private includes ----------------------------------------------------------*/
34-
/* USER CODE BEGIN Includes */
33+
/* Private includes ----------------------------------------------------------*/
34+
/* USER CODE BEGIN Includes */
3535

36-
/* USER CODE END Includes */
36+
/* USER CODE END Includes */
3737

38-
/* Exported types ------------------------------------------------------------*/
39-
/* USER CODE BEGIN ET */
40-
#ifdef env1
38+
/* Exported types ------------------------------------------------------------*/
39+
/* USER CODE BEGIN ET */
4140

42-
typedef enum SensorDef
43-
{
44-
CENTER = 0,
45-
LEFT = 2,
46-
RIGHT = 1,
47-
TOP = 2,
48-
BOTTOM = 3
49-
} sensorDev;
50-
51-
#endif
52-
#ifdef env2
53-
#ifdef drie1
54-
55-
typedef enum SensorDef
56-
{
57-
CENTER = 0,
58-
LEFT = 2,
59-
RIGHT = 1,
60-
} sensorDev;
61-
62-
#endif
63-
#ifdef drie2
64-
65-
typedef enum SensorDev
41+
typedef enum SensorDev
6642
{
6743
XSHUT_4 = 4,
6844
XSHUT_3 = 3,
6945
XSHUT_2 = 2,
7046
XSHUT_1 = 1,
71-
XSHUT_0 = 1
47+
XSHUT_0 = 0
7248
} sensorDev;
7349

74-
#endif
75-
#endif
76-
77-
typedef struct Sensor_Definition
78-
{
79-
sensorDev gpioPin;
80-
uint8_t id;
81-
} Sensor_Definition_t;
50+
typedef struct Sensor_Definition
51+
{
52+
sensorDev gpioPin;
53+
uint8_t id;
54+
} Sensor_Definition_t;
8255

8356
typedef enum commands
8457
{

Code PlatformIO/Gesture Control Testing Setup/lib/Gesture_Detect/src/GestureDetect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "main.h"
1818
#include "stdbool.h"
1919

20-
#define maxMean 8
20+
#define maxMean 4
2121
#define maxDistance 300U
2222
#define timerMeasurmentTimeout 1500U
2323

Code PlatformIO/Gesture Control Testing Setup/src/main.c

+20-107
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ int main(void)
155155

156156
CUSTOM_VL53L3CX_I2C_Init();
157157

158-
//De sensoren initialiseren
158+
// De sensoren initialiseren
159159
Init_Sensor(&sensor[center.id], center.gpioPin);
160160
Init_Sensor(&sensor[left.id], left.gpioPin);
161161
Init_Sensor(&sensor[right.id], right.gpioPin);
162162

163-
//Als de drukknop SW_1 actief is, wordt er gekalibreerd
163+
// Als de drukknop SW_1 actief is, wordt er gekalibreerd
164164
if (HAL_GPIO_ReadPin(SW_1_GPIO_Port, SW_1_Pin))
165165
{
166166
getCalibrate(&sensor[center.id], center.id);
@@ -209,14 +209,14 @@ int main(void)
209209
}
210210
else
211211
{
212-
setCalibrate(&sensor[center.id], center.id);;
213-
setCalibrate(&sensor[left.id], left.id);
214-
setCalibrate(&sensor[right.id], right.id);
212+
// setCalibrate(&sensor[center.id], center.id);;
213+
// setCalibrate(&sensor[left.id], left.id);
214+
// setCalibrate(&sensor[right.id], right.id);
215215
}
216216

217+
Start_Sensor(&sensor[center.id], center.gpioPin);
217218
Start_Sensor(&sensor[left.id], left.gpioPin);
218-
// Start_Sensor(&sensor[left.id], left.gpioPin);
219-
// Start_Sensor(&sensor[right.id], right.gpioPin);
219+
Start_Sensor(&sensor[right.id], right.gpioPin);
220220

221221
/* USER CODE END 2 */
222222

@@ -225,118 +225,31 @@ int main(void)
225225

226226
initObjectPresent(-1, -1, -1);
227227

228+
int leftDistance = 0;
229+
int centerDistance = 0;
230+
int rightDistance = 0;
231+
228232
while (1)
229233
{
230234
isReady[left.id] = getData(&sensor[left.id], &left, &resultaat[left.id], (uint8_t *)isReady);
231235
setMeanVal(left.id, resultaat[left.id].distance);
232236

233-
if (objectPresent)
234-
{
235-
isReady[center.id] = getData(&sensor[center.id], &center, &resultaat[center.id], (uint8_t *)isReady);
236-
setMeanVal(center.id, resultaat[center.id].distance);
237+
isReady[center.id] = getData(&sensor[center.id], &center, &resultaat[center.id], (uint8_t *)isReady);
238+
setMeanVal(center.id, resultaat[center.id].distance);
237239

238-
isReady[right.id] = getData(&sensor[right.id], &right, &resultaat[right.id], (uint8_t *)isReady);
239-
setMeanVal(right.id, resultaat[right.id].distance);
240-
}
240+
isReady[right.id] = getData(&sensor[right.id], &right, &resultaat[right.id], (uint8_t *)isReady);
241+
setMeanVal(right.id, resultaat[right.id].distance);
241242

242-
objectPresent = ckeckObjectPresent(&resultaat[left.id], &objectPresent, &resultaat[left.id].distance);
243-
int leftDistance = 0;
244-
int centerDistance = 0;
245-
int rightDistance = 0;
246-
// Wanneer er geen commando aanwezig is, kijken ofdat er een gesture is
247-
if (commando == NONE)
248-
{
249-
leftDistance = getMean(left.id);
250-
centerDistance = getMean(center.id);
251-
rightDistance = getMean(right.id);
252-
int8_t val = detectgesture(leftDistance, resultaat[left.id].status, centerDistance, resultaat[center.id].status, rightDistance, resultaat[right.id].status);
253-
if (val != -1)
254-
commando = val;
255-
256-
//printf("leftDistance: %5d,centerDistance: %5d,rightDistance: %5d \r\n", leftDistance, centerDistance, rightDistance);
257-
}
243+
leftDistance = getMean(left.id);
244+
centerDistance = getMean(center.id);
245+
rightDistance = getMean(right.id);
258246

259-
checkResetTimer();
260247

261248
HAL_GPIO_WritePin(LED_3_GPIO_Port, LED_3_Pin, objectPresent);
262249
/* USER CODE END WHILE */
263250

264251
/* USER CODE BEGIN 3 */
265252

266-
if (objectPresent && !prevObjectPresent)
267-
{
268-
// Opstarten van sensoren
269-
Start_Sensor(&sensor[center.id], center.gpioPin);
270-
Start_Sensor(&sensor[right.id], right.gpioPin);
271-
// printf("Start\r\n");
272-
}
273-
274-
if (!objectPresent && prevObjectPresent)
275-
{
276-
Stop_Sensor(&sensor[center.id]);
277-
Stop_Sensor(&sensor[right.id]);
278-
// printf("Stop\r\n");
279-
}
280-
281-
prevObjectPresent = objectPresent;
282-
283-
/* Timer om leds even aan te laten
284-
Er wordt gekeken wanneer commando veranderd wordt naar alles behalve NONE.
285-
Dan zetten we een timer
286-
Wanneer de timer afloopt wordt het commando gereset
287-
*/
288-
if (!timerCommandSet && commando != NONE)
289-
{
290-
timerCommandSet = true;
291-
timerCommand = HAL_GetTick();
292-
// printf("command: %2d\r\n", commando);
293-
}
294-
if ((HAL_GetTick() - timerCommand) >= timerCommandTimeout)
295-
{
296-
timerCommandSet = false;
297-
commando = NONE;
298-
}
299-
// Commando's uitsturen
300-
switch (commando)
301-
{
302-
case NONE:
303-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_RESET);
304-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_RESET);
305-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_RESET);
306-
break;
307-
case RL:
308-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_SET);
309-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_RESET);
310-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_RESET);
311-
break;
312-
case LR:
313-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_RESET);
314-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_SET);
315-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_RESET);
316-
break;
317-
case UD:
318-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_SET);
319-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_SET);
320-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_RESET);
321-
break;
322-
case DU:
323-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_RESET);
324-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_RESET);
325-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_SET);
326-
break;
327-
case DIM:
328-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_SET);
329-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_RESET);
330-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_SET);
331-
break;
332-
333-
default:
334-
HAL_GPIO_WritePin(LED_0_GPIO_Port, LED_0_Pin, GPIO_PIN_RESET);
335-
HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_RESET);
336-
HAL_GPIO_WritePin(LED_2_GPIO_Port, LED_2_Pin, GPIO_PIN_RESET);
337-
break;
338-
}
339-
340253
HAL_GPIO_TogglePin(LED_4_GPIO_Port, LED_4_Pin);
341254

342255
#ifdef DATACOLLECTION
@@ -350,8 +263,8 @@ int main(void)
350263
// printf("%d,%d\r\n", leftDistance, resultaat[left.id].status);
351264
// printf("L%d, C%d, R%d\r\n", leftDistance, centerDistance, rightDistance);
352265
int8_t buf;
353-
HAL_I2C_Slave_Receive_IT(&hi2c2, &buf, sizeof(buf));
354-
HAL_Delay(20);
266+
//HAL_I2C_Slave_Receive_IT(&hi2c2, &buf, sizeof(buf));
267+
HAL_Delay(1);
355268
}
356269
/* USER CODE END 3 */
357270
}

docs/Onderzoek.md

+24-20
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Het zal bepaalde onderdelen staven waarom ik de desbetreffende zaken in het proj
3333
- [Smudge Detection glasplaat](#smudge-detection-glasplaat)
3434
- [Trap in software verwerkt](#trap-in-software-verwerkt)
3535
- [Op papier](#op-papier)
36-
- [Met data](#met-data)
36+
- [Met Data](#met-data)
3737
- [Bevindingen](#bevindingen)
3838

3939

@@ -786,11 +786,12 @@ Bij de rechtse hand is dit weer overlapping namelijk **321** (Dit is wanneer we
786786

787787
Met deze gegevens kunnen we vaststellen dat we best voor de linker hand een aparte opstelling maken en voor de rechterhand idem.
788788

789-
## Met data
789+
## Met Data
790790

791-
!> Deze metingen zijn uitgevoerd zonder coverglas en zonder enige kalibratie.
791+
!> Deze metingen zijn uitgevoerd zonder coverglas en zonder enige kalibratie. De afstand is een gemiddelde over 4 metingen. De opstelling is degenen die we bij [Trap](#trap) hebben bekomen.
792792

793-
<table>
793+
<div style="display:inline-block; background-color:white">
794+
<table style="background-color: white; color: black; display:inline;">
794795
<tr>
795796
<th colspan="2"></th>
796797
<th>LR</th>
@@ -801,34 +802,37 @@ Met deze gegevens kunnen we vaststellen dat we best voor de linker hand een apar
801802
<tr>
802803
<td rowspan="2">linkse hand</td>
803804
<td>zonder duim</td>
804-
<td>321</td>
805-
<td>312</td>
806-
<td>312</td>
807-
<td>312</td>
805+
<td><img src="./foto's/LR_L_ND_N.png" alt="LEFT RIGHT LEFT NIETDUIM NIETSPIEGEL" width="100%"></td>
806+
<td><img src="./foto's/RL_L_ND_N.png" alt="RIGHT LEFT LEFT NIETDUIM NIETSPIEGEL" width="100%"></td>
807+
<td><img src="./foto's/UD_L_ND_N.png" alt="UP DOWN LEFT NIETDUIM NIETSPIEGEL" width="100%"></td>
808+
<td><img src="./foto's/DU_L_ND_N.png" alt="DOWN UP LEFT NIETDUIM NIETSPIEGEL" width="100%"></td>
808809
</tr>
809810
<tr>
810811
<td>met duim</td>
811-
<td>321</td>
812-
<td>312</td>
813-
<td>312</td>
814-
<td>312</td>
812+
<td><img src="./foto's/LR_L_D_N.png" alt="LEFT RIGHT LEFT DUIM NIETSPIEGEL" width="100%"></td>
813+
<td><img src="./foto's/RL_L_D_N.png" alt="RIGHT LEFT LEFT DUIM NIETSPIEGEL" width="100%"></td>
814+
<td><img src="./foto's/UD_L_D_N.png" alt="UP DOWN LEFT DUIM NIETSPIEGEL" width="100%"></td>
815+
<td><img src="./foto's/DU_L_D_N.png" alt="DOWN UP LEFT DUIM NIETSPIEGEL" width="100%"></td>
815816
</tr>
816817
<tr>
817818
<td rowspan="2">rechtse hand</td>
818819
<td>zonder duim</td>
819-
<td>321</td>
820-
<td>312</td>
821-
<td>312</td>
822-
<td>312</td>
820+
<td><img src="./foto's/LR_R_ND_N.png" alt="LEFT RIGHT RIGHT NIETDUIM NIETSPIEGEL" width="100%"></td>
821+
<td><img src="./foto's/RL_R_ND_N.png" alt="RIGHT LEFT RIGHT NIETDUIM NIETSPIEGEL" width="100%"></td>
822+
<td><img src="./foto's/UD_R_ND_N.png" alt="UP DOWN RIGHT NIETDUIM NIETSPIEGEL" width="100%"></td>
823+
<td><img src="./foto's/DU_R_ND_N.png" alt="DOWN UP RIGHT NIETDUIM NIETSPIEGEL" width="100%"></td>
823824
</tr>
824825
<tr>
825826
<td>met duim</td>
826-
<td>321</td>
827-
<td>312</td>
828-
<td>312</td>
829-
<td>312</td>
827+
<td><img src="./foto's/LR_R_D_N.png" alt="LEFT RIGHT RIGHT DUIM NIETSPIEGEL" width="100%"></td>
828+
<td><img src="./foto's/RL_R_D_N.png" alt="RIGHT LEFT RIGHT DUIM NIETSPIEGEL" width="100%"></td>
829+
<td><img src="./foto's/UD_R_D_N.png" alt="UP DOWNRIGHT DUIM NIETSPIEGEL" width="100%"></td>
830+
<td><img src="./foto's/DU_R_D_N.png" alt="DOWN UP RIGHT DUIM NIETSPIEGEL" width="100%"></td>
830831
</tr>
831832
</table>
833+
</div>
834+
835+
Bij het vergelijken van de meetingen tussen een hand met duim en zonder duim, is er weinig verschil merkbaar. Enkel is het merkbaar aan de meetingen wanneer ik mijn linker of rechter hand gebruik (zie links-LR en rechts-LR naar de afvlakking naar boven).
832836

833837
# Bevindingen
834838

docs/foto's/DU_L_D_N.png

90.6 KB
Loading

docs/foto's/DU_L_ND_N.png

89.7 KB
Loading

docs/foto's/DU_R_D_N.png

85 KB
Loading

docs/foto's/DU_R_D_N_SNEL.png

77.7 KB
Loading

docs/foto's/DU_R_ND_N.png

79.2 KB
Loading

docs/foto's/LR_L_D_N.png

99.5 KB
Loading

docs/foto's/LR_L_ND_N.png

96.4 KB
Loading

docs/foto's/LR_R_D_N.png

84.5 KB
Loading

docs/foto's/LR_R_D_N_SNEL.png

78.4 KB
Loading

docs/foto's/LR_R_ND_N.png

85.7 KB
Loading

docs/foto's/RL_L_D_N.png

101 KB
Loading

docs/foto's/RL_L_ND_N.png

95 KB
Loading

docs/foto's/RL_R_D_N.png

91.8 KB
Loading

docs/foto's/RL_R_D_N_SNEL.png

86.9 KB
Loading

docs/foto's/RL_R_ND_N.png

85.3 KB
Loading

docs/foto's/UD_L_D_N.png

81.6 KB
Loading

docs/foto's/UD_L_ND_N.png

90.1 KB
Loading

docs/foto's/UD_R_D_N.png

93.3 KB
Loading

docs/foto's/UD_R_D_N_SNEL.png

79.3 KB
Loading

docs/foto's/UD_R_ND_N.png

84 KB
Loading

0 commit comments

Comments
 (0)