Skip to content

ADDED: Function that caculates the linearized rotational dynamics - #83

Open
harrywangsw wants to merge 1 commit into
attitude-pyfrom
dev/linearized_model
Open

ADDED: Function that caculates the linearized rotational dynamics#83
harrywangsw wants to merge 1 commit into
attitude-pyfrom
dev/linearized_model

Conversation

@harrywangsw

Copy link
Copy Markdown
Contributor

I've also added a pdf file with my derivations

Comment thread attitude.py
Linearized input matrix.
Shape: (6, 3)
"""
J_inv = np.linalg.inv(J)

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.

It's not the worst thing ever with a 3x3 matrix, but it's good practice to do operations like matrix inversions once where possible (inertia matrix is such a case) because it can be computationally expensive. I would suggest adding an optional J_inv argument to the function signature and only performing this inversion here if it is not provided.

Comment thread attitude.py
q1, q2, q3 = q_0
omega1, omega2, omega3 = omega_0

A_omega_omega = J_inv@(skew(J @ omega_0)-skew(omega_0)@J)

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.

Please add some comments clarifying the process here. Even for the purposes of review, having it bare means I have to try to figure out what you're doing/why at each line before I can even assess whether it's right. If someone with less context/experience has to read this code later it could be very difficult for them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I pushed a pdf latex file with more intermediate steps filled out. Should I add more here too?

Comment thread attitude.py

B = np.vstack([
J_inv,
np.zeros((3, 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 not sure if this is a mistake or a convention thing that I missed. I would expect J_inv to be the bottom term here as it applies to torques, which directly contribute to dot{omega}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have omega_dot in the first 3 components of the state vector and q_dot in the last 3. So the J_inv's position is correct. However, I realize that this is kinda unconventional so yes, I'll swap those two.

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