Dev/attitude tests#61
Conversation
Replacing test.py with a folder of test files
because this file contained simulation info, not unit or integration tests
| ) | ||
|
|
||
| plt.figure() | ||
| plt.plot(t, qnorm) |
There was a problem hiding this comment.
Could you just confirm in a reply that the norm remains 1 throughout the simulation?
There was a problem hiding this comment.
Nevermind, I see that gets tested in the other file. But now I'm wondering what this file is for?
| omega = np.array([1.0, 2.0, 3.0]) | ||
| J = np.eye(3) | ||
| Jinv = np.linalg.inv(J) | ||
| torque = np.array([[0.1], [0.2], [0.3]]) |
There was a problem hiding this comment.
I'm a little suspicious of the brackets here. Usually numpy is ambivalent to whether a vector is in row form or column form and I've had issues when trying to format it in a MATLAB-esque way like this. Does it behave as expected?
| ) | ||
|
|
||
| # Assert | ||
| np.testing.assert_allclose(q_norm, 1.0, atol=1e-2) |
There was a problem hiding this comment.
I would like to see the tolerance on this made tighter. As low as 1e-9 probably.
| def test_angular_momentum_conservation(): | ||
| # Arrange | ||
| epsilon0 = np.array([0.1, 0.2, 0.3]) | ||
| eta0 = np.sqrt(1 - np.linalg.norm(epsilon0)**2) |
There was a problem hiding this comment.
You're having to use this quite a bit. Might not be a bad idea to create a util function to do this, or even one to generate a random unit quaternion outright.
| np.testing.assert_allclose(eta_dot, 0.0) | ||
|
|
||
| # Test 6: Checking if attitude_dynamics works with zero torque and zero angular velocity | ||
| def test_attitude_dunamics_zero_input(): |
| error = np.linalg.norm(H - H0, axis=1) | ||
|
|
||
| # Assert | ||
| np.testing.assert_allclose(error, 0.0, atol=1e-2) |
There was a problem hiding this comment.
Would make this tolerance tighter as well
No description provided.