Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created unit tests for detumble.py #57

Merged
merged 8 commits into from
Dec 27, 2024
Merged

Created unit tests for detumble.py #57

merged 8 commits into from
Dec 27, 2024

Conversation

TaylorGilg
Copy link
Contributor

@TaylorGilg TaylorGilg commented Dec 24, 2024

  • Created unit tests for functions dot_product(), x_product(), and magnetorquer_dipole() in detumble.py (detumble.py is identical for Batt_Board and FC_Board) with realistic argument inputs
    Bigger context:
  • do_detumble() (in functions.py in FC_Boards and battery_functions.py in Batt_Board) calls the magnetorquer_dipole() method (that calls the other methods dot_product and x_product) with tuple arguments of magnetic field strength at x,y,& z axis and angular velocities at x,y,& z axis. The method returns a list value for dipole_out (to be used to inform actuators on how much force must be applied for detumbling)

- Created unit tests for functions dot_product(), x_product(), and magnetorquer_dipole() in detumble.py in Batt_Board (there is an identical detumble.py in FC_Board) with realistic argument inputs
Bigger context:
- do_detumble() (in functions.py in FC_Boards and battery_functions.py in Batt_Board) calls the magnetorquer_dipole() method (that calls the other methods dot_product and x_product) with tuple arguments of magnetic field strength at x,y,&z axis and angular velocities at x,y,&z axis. The method returns a list value for dipole_out (to be used to inform actuators on how much force must be applied for detumbling)
How to run: "cd Tests" > "cd unit_tests" > "python3 test_detumble.py"
@nateinaction
Copy link
Member

Holy moly the first unit tests in the repo! I've done some work on adding automated testing to the repo in #26 and chose pytest because instead of the built-in unittest library because it seemed more widely used and was faster because it could run tests in parallel (here's a review comparing them).

Could you switch these tests over to use pytest and then reuse some of the automation introduced in PR #26 to have it run automatically on commit? Pulling over those changes might be as simple as git checkout origin/python-type-declarations -- .github/workflows/ci.yaml .vscode/settings.json Makefile README.md requirements.txt

If you change the requirements file don't forget to rerun your pip install!

@nateinaction
Copy link
Member

This is looking good! Since there are two "separate" code bases in this repo FC_Board and Batt_Board it might be helpful to have separate test suites for both until we combine everything into a single board. As it turns out, putting the test files inside of /FC_Board helps with the import issue we're seeing in CI too! I put up a few changes against your branch here: #62

If you like them, feel free to include them!

Fixing up automation settings and fixing import issues
@TaylorGilg TaylorGilg merged commit d3a998b into main Dec 27, 2024
2 checks passed
@TaylorGilg TaylorGilg deleted the DetumbleUnitTest branch December 27, 2024 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants