Tested manual fingerprinting for ferrite setup

This commit is contained in:
seyffejn 2021-02-02 10:49:14 +01:00
parent 036ec76155
commit 0c9278c54e
48 changed files with 18 additions and 13 deletions

View File

@ -51,7 +51,7 @@ class ART_plotting:
"color":"black",
"size":15}
plt.plot(art_info[:, 1], art_info[:, 2], color="lightgreen", label="ART System", linewidth=5, marker="x")
plt.plot(art_info[:, 1], art_info[:, 2], color="green", label="ART System", linewidth=5, marker="x")
print("x=", art_info[:, 1])
print("y=", art_info[:, 2])

View File

@ -6,7 +6,9 @@ class Localization:
def __init__(self):
self.scale_factor = 0.003
self.k_nearest = 15
self.table = np.load('fingerprinting_tables/Julian_1cm_precision_corrected_antenas.npy')
#self.table = np.load('fingerprinting_tables/Julian_1cm_precision_corrected_antenas.npy') # corrected table made by Ihm (No ferrite)
#self.table = np.load('fingerprinting_tables/SmallManualFingerprint_Ferrite.npy') # manual fingerprinting table (Ferrite) [A bit off]
#self.table = np.load('fingerprinting_tables/Julian_BThesis_table2_switchedAnt5&6 and 7&8.npy') # Switched Ant5<->6 and 7<->8 in Excel (No Ferrite) [Does not work!]
self.data = np.load('recorded_data/current_recording.npy')
@ -24,10 +26,12 @@ class Localization:
Output: - position [type = np.array[3]]:
The estimated position of the object in this sample x,y,z
"""
#print("fv =", fv)
print("fv =", fv)
feature_vector = fv * self.scale_factor
print("table=", self.table)
repeated_feature_vector = np.square(self.table[:, 9:] - feature_vector)
euclidean_distances = np.sum(repeated_feature_vector, 1)
order = np.argsort(euclidean_distances)

View File

@ -19,13 +19,13 @@ plt.subplots_adjust(left=0.07, bottom=0.07, right=0.89, top=0.89, wspace=0.2, hs
# Set Axis
ax1.set_xlim([-0.02*mm, 0.52*mm])
ax1.set_ylim([-0.02*mm, 0.52*mm])
ax1.set_xticks(np.arange(0.0*mm, 0.55*mm, 0.05*mm))
ax1.set_yticks(np.arange(0.0*mm, 0.55*mm, 0.05*mm))
#ax1.set_xticks(np.arange(0.0*mm, 0.55*mm, 0.05*mm))
#ax1.set_yticks(np.arange(0.0*mm, 0.55*mm, 0.05*mm))
ax1.set_xlabel('X-Position of object [mm]', fontdict=font)
ax1.set_ylabel('Y-Position of object [mm]', fontdict=font)
ax1.grid(alpha=0.6)
for label in ax1.xaxis.get_ticklabels():
label.set_rotation(90)
#for label in ax1.xaxis.get_ticklabels():
# label.set_rotation(90)
ax2.set_ylim([0.1*mm, 0.6*mm])
ax2.set_xlim([0.0*mm, 0.2*mm])
@ -153,7 +153,7 @@ def plot_art(recording_number):
pos_counter += 1
ax1.plot(art_info[:, 1], art_info[:, 2], color="Gold", label="ART System", linewidth=5, marker="x")
ax1.plot(art_info[:, 1], art_info[:, 2], color="green", label="ART System", linewidth=1)
print("x=", art_info[:, 1])
print("y=", art_info[:, 2])
@ -165,10 +165,11 @@ plotting = Plotting()
# Decide what scaling_factors and Recording
scale_factors = np.arange(0.001, 0.0035, 0.0005)
localization.k_nearest = 5
#scale_factors = np.arange(0.001, 0.0035, 0.0005)
scale_factors = [1]
localization.k_nearest = 15
Recording = 15 # which ART Recording to pick
Recording = 5 # which ART Recording to pick
for sf in scale_factors:
@ -185,8 +186,8 @@ for sf in scale_factors:
positions = positions * mm # convert from m to mm
# Plot IndLoc Positions
ax1.plot(positions[:, 0], positions[:, 1], label="sf = " + str(sf), linewidth=2)
ax2.plot(positions[:, 2], positions[:, 1], label="sf = " + str(sf), linewidth=2)
ax1.plot(positions[:, 0], positions[:, 1], label="sf = " + str(sf), linewidth=1)
ax2.plot(positions[:, 2], positions[:, 1], label="sf = " + str(sf), linewidth=1)
plot_art(Recording)

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB