dknathalage / SIT329-Project

0 stars 3 forks source link

Setup more sensors to add to the test bench for reading measurements. #45

Open nadavfedida opened 1 year ago

nadavfedida commented 1 year ago

Once the placement is confirmed of all the sensor locations on the bike, I will simulate the capacitive sensors with 4 ultrasonic distance finders to allow me to test the decision matrix.

nadavfedida commented 1 year ago

This part was not done in a physical form as the Jaycar was on backorder for the required sensors.

I took on the liberty to create a testing scenario in code, where each new session will have a new array instantiated with values ranging from 0 to 4095 (4096 range) as this is the expected value range from the sensors we made to be fitted on the bike.

The code for this is:

numberOfSensors = 4
numberOfsamples = 100
Inputs =  np.random.randint(0, 4095, size=(numberOfSensors, numberOfsamples))

Here we can see the number of sensors used can easily be changed this way, as well as the sample size for the session testing purposes.

The output from this code comes out in this format.

[[ 322 1254 1387 1393  675  801 3734 3635 3721  927]
 [2736 3188 3781 3690  760 2272 2827 2540 2776  612]
 [3364 3983 1052 1513 3013 1250  745  787 3142 2613]
 [2271 3036  617 2007 2151 1243  586 2936 3872 2059]]

The code was adjusted to be 4 sensors with a sample size of 10 for simplicity

Once the code is running, the following is the flowing data output that is generated from this sample data:

[True, False, False, True]
[True, False, False, True]
[False, True, False, False]
Elbows MATCH >> Sensor:  3 

Sending Elbows with time  2.14
[False, False, False, True]
[False, True, True, False]
[False, True, True, True]
[False, False, False, True]
[False, True, False, False]
Elbows MATCH >> Sensor:  3 

[True, False, True, False]
Froome MATCH >> Sensor:  2 

Sending Froome with time  3.66
[False, True, False, False]
Elbows MATCH >> Sensor:  3 

Sending Elbows with time  1.17
[False, True, False, True]
[False, True, True, True]
[True, True, True, False]
[True, False, True, True]
TopTube MATCH >> Sensor:  0 

Sending TopTube with time  2.63
[False, True, True, False]
[False, False, False, True]
[False, False, True, False]
[False, False, False, False]
^CMeasurement stopped by User

Here we can see each line is outputting if the random number generated in the above array is above (True) or below (False) the threshold set in the code. This is an adjustable threshold to finely tune for the best performance and reliability on the actual sensors.

After each line, once the 4 states are checked, the code will compare the data to the position matrix table we have designed to accurately estimate which position the user is in.