forked from zietzm/Helmholtz_Test_Bench
Some fixes
This commit is contained in:
+4
-3
@@ -238,7 +238,7 @@ class CoilConstantCalibration(Thread):
|
||||
class MagnetometerCalibration(Thread):
|
||||
TEST_VECTOR_MAGNITUDE = 100e-6 # In Tesla. Chosen so it can be achieved with a 3A PSU.
|
||||
|
||||
def __init__(self, view_queue, calibration_points, calibration_interval,mgm_to_helmholtz_cos_trans):
|
||||
def __init__(self, view_queue, calibration_points, calibration_interval, mgm_to_helmholtz_cos_trans):
|
||||
Thread.__init__(self)
|
||||
self.view_queue = view_queue
|
||||
self.calibration_points = calibration_points
|
||||
@@ -283,8 +283,9 @@ class MagnetometerCalibration(Thread):
|
||||
self.cage_dev.set_field_compensated([0, 0, 0])
|
||||
# Sleep for a certain duration to allow psu to stabilize output and magnetometer to supply readings
|
||||
time.sleep(self.calibration_interval)
|
||||
matrix_trans_mgm_to_hh_np = np.array(self.matrix_trans_mgm_to_hh)
|
||||
# The offsets can easily be read from the magnetometer
|
||||
offsets = self.matrix_trans_mgm_to_hh.dot(g.MAGNETOMETER.field)
|
||||
offsets = matrix_trans_mgm_to_hh_np.dot(g.MAGNETOMETER.field)
|
||||
# Save data point to raw_data list
|
||||
raw_data.append({'applied_x': 0, 'applied_y': 0, 'applied_z': 0,
|
||||
'measured_x': offsets[0], 'measured_y': offsets[1], 'measured_z': offsets[2]})
|
||||
@@ -308,7 +309,7 @@ class MagnetometerCalibration(Thread):
|
||||
time.sleep(self.calibration_interval)
|
||||
|
||||
# Read output and save to array for solver later
|
||||
raw_reading = self.matrix_trans_mgm_to_hh.dot(g.MAGNETOMETER.field)
|
||||
raw_reading = matrix_trans_mgm_to_hh_np.dot(g.MAGNETOMETER.field)
|
||||
reading = raw_reading - offsets
|
||||
for i in range(3):
|
||||
row = {'m': reading[i], 'b_x': applied_vec[0], 'b_y': applied_vec[1], 'b_z': applied_vec[2]}
|
||||
|
||||
@@ -1281,7 +1281,7 @@ class CalibrateMagnetometer(Frame):
|
||||
# Enable save buttons
|
||||
self.export_calibration_button.configure(state="normal")
|
||||
self.copy_calibration_button.configure(state="normal")
|
||||
self.export_mgm_button.configure(state="normal")
|
||||
# self.export_mgm_button.configure(state="normal")
|
||||
|
||||
def start_calibration_procedure(self):
|
||||
try:
|
||||
@@ -1289,7 +1289,8 @@ class CalibrateMagnetometer(Frame):
|
||||
calibration_interval = self.calibration_interval_var.get()
|
||||
self.calibration_thread = MagnetometerCalibration(self.view_mpi_queue,
|
||||
calibration_points,
|
||||
calibration_interval)
|
||||
calibration_interval,
|
||||
self.mgm_to_helmholtz_cos_trans)
|
||||
self.calibration_thread.start()
|
||||
self.deactivate_buttons()
|
||||
except (DeviceAccessError, TclError) as e:
|
||||
|
||||
Reference in New Issue
Block a user