Skip to content

Commit

Permalink
Update inertialAttitudeUkf unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
leahkiner committed Sep 30, 2024
1 parent 78367c4 commit 5be4d1f
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pytest
from Basilisk.architecture import messaging
from Basilisk.fswAlgorithms import inertialAttitudeUkf
from Basilisk.fswAlgorithms import miruLowPassFilterConverter
from Basilisk.utilities import SimulationBaseClass, macros
from Basilisk.utilities import RigidBodyKinematics as rbk

Expand Down Expand Up @@ -107,6 +108,11 @@ def test_propagation_kf(show_plots):
test_process = unit_test_sim.CreateNewProcess(unit_process_name)
test_process.addTask(unit_test_sim.CreateNewTask(unit_task_name, test_process_rate))

# Create miruLowPassFilterConverter module
miru_low_pass_filter_converter = miruLowPassFilterConverter.MiruLowPassFilterConverter()
miru_low_pass_filter_converter.setLowPassFilter(0.5, 15/(2*np.pi))
unit_test_sim.AddModelToTask(unit_task_name, miru_low_pass_filter_converter)

# Construct algorithm and associated C++ container
allMeasurements = inertialAttitudeUkf.AttitudeFilterMethod_AllMeasurements
intertialAttitudeFilter = inertialAttitudeUkf.InertialAttitudeUkf(allMeasurements)
Expand Down Expand Up @@ -173,7 +179,7 @@ def test_propagation_kf(show_plots):

accel_data = messaging.AccDataMsgPayload()
accel_measurement = messaging.AccDataMsg().write(accel_data)
intertialAttitudeFilter.accelDataMsg.subscribeTo(accel_measurement)
miru_low_pass_filter_converter.imuAccelDataInMsg.subscribeTo(accel_measurement)

attitude_data_log = intertialAttitudeFilter.inertialFilterOutputMsg.recorder()
unit_test_sim.AddModelToTask(unit_task_name, attitude_data_log)
Expand Down Expand Up @@ -226,6 +232,11 @@ def test_measurements_kf(show_plots, initial_error, method):
test_process = unit_test_sim.CreateNewProcess(unit_process_name)
test_process.addTask(unit_test_sim.CreateNewTask(unit_task_name, test_process_rate))

# Create miruLowPassFilterConverter module
miru_low_pass_filter_converter = miruLowPassFilterConverter.MiruLowPassFilterConverter()
miru_low_pass_filter_converter.setLowPassFilter(0.5, 15/(2*np.pi))
unit_test_sim.AddModelToTask(unit_task_name, miru_low_pass_filter_converter)

intertialAttitudeFilter = inertialAttitudeUkf.InertialAttitudeUkf(method)
unit_test_sim.AddModelToTask(unit_task_name, intertialAttitudeFilter)

Expand Down Expand Up @@ -292,9 +303,13 @@ def test_measurements_kf(show_plots, initial_error, method):
star_tracker2.measurementNoise = [[1e-4, 0, 0], [0,1e-4,0], [0,0,1e-4]]
intertialAttitudeFilter.addStarTrackerInput(star_tracker2)

imu_sensor_msg = messaging.IMUSensorMsgPayload()
imu_sensor_message = messaging.IMUSensorMsg().write(imu_sensor_msg)
intertialAttitudeFilter.imuSensorDataInMsg.subscribeTo(imu_sensor_message)

accel_data = messaging.AccDataMsgPayload()
accel_measurement = messaging.AccDataMsg().write(accel_data)
intertialAttitudeFilter.accelDataMsg.subscribeTo(accel_measurement)
miru_low_pass_filter_converter.imuAccelDataInMsg.subscribeTo(accel_measurement)

filter_data_log = intertialAttitudeFilter.inertialFilterOutputMsg.recorder()
unit_test_sim.AddModelToTask(unit_task_name, filter_data_log)
Expand Down

0 comments on commit 5be4d1f

Please sign in to comment.