Skip to content

Dev/attitude tests#61

Open
Srishti-KuttyKrishnan wants to merge 3 commits into
attitude-pyfrom
dev/attitude-tests
Open

Dev/attitude tests#61
Srishti-KuttyKrishnan wants to merge 3 commits into
attitude-pyfrom
dev/attitude-tests

Conversation

@Srishti-KuttyKrishnan

Copy link
Copy Markdown
Collaborator

No description provided.

)

plt.figure()
plt.plot(t, qnorm)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just confirm in a reply that the norm remains 1 throughout the simulation?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I see that gets tested in the other file. But now I'm wondering what this file is for?

Comment thread tests/test_attitude.py
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]])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread tests/test_attitude.py
)

# Assert
np.testing.assert_allclose(q_norm, 1.0, atol=1e-2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see the tolerance on this made tighter. As low as 1e-9 probably.

Comment thread tests/test_attitude.py
def test_angular_momentum_conservation():
# Arrange
epsilon0 = np.array([0.1, 0.2, 0.3])
eta0 = np.sqrt(1 - np.linalg.norm(epsilon0)**2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/test_attitude.py
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():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: dunamics

Comment thread tests/test_attitude.py
error = np.linalg.norm(H - H0, axis=1)

# Assert
np.testing.assert_allclose(error, 0.0, atol=1e-2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make this tolerance tighter as well

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