-
Notifications
You must be signed in to change notification settings - Fork 9
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
Attitude model #194
Attitude model #194
Conversation
…now in my own fork instead of Moana's)
…erence frame transformation function
…unction to form this transformation matrix)
…of floats, outputs: numpy arrays (needs to be reviewed in implementation)
…l and magnetic) on actor. started with set_attitude_model and attitude model class as well.
…access the I-matrix)
deleted redundant function (which I added myself)
pointing vector function
…me as euler angles)
…) doesn't produce correct pointing vectors, need to find solution to transform vector from body to ECI with non-zero 3d attitude angle vector (roll, pitch, yaw), resulting in correct pointing.
…nting vectors. Exact workings of these rotations not understood fully yet, needs more looking into. next step: add accelerations
…esn't physically rotate a vector)
…are correct. Find relationship between theta1 and thata2 and roll - pitch - yaw
… with rodriguez' rotations and get attitude with new function
…relative to previous timestep (instead of t0, this avoids problems for later) and rpy angles are now correctly implemented (with default order y-p-r)
…of having an initial acceleration).
…ference frame transfer file to utils
Final commits before pull request
@Mr-Medina Should we have a look and give you some feedback? :) You can request a review in the top right with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a first glance, it looks good. We can have a dedicated discussion later on. I would wait for the geometric model PR to be updated as requested. This code needs also to capitalize on that PR.
np.array([Tx, Ty, Tz]): total combined torques in Nm | ||
""" | ||
|
||
T = np.array([0.0, 0.0, 0.0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with what you are doing later, T shall be expressed with respect to the body frame. Can you confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the T vector will be expressed in the body frame
def calculate_angular_acceleration(self): | ||
"""Calculate the spacecraft angular acceleration (external disturbance torques and gyroscopic accelerations)""" | ||
# todo: implement geometric model | ||
# I = self._actor_moment_of_inertia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a placeholder? Why don't you capitalize on your previous PR? Also, from the comment on the previous PR, can you confirm that I is expressed with respect to the body frame?
I = np.array([[50, 0, 0], [0, 50, 0], [0, 0, 50]]) # test placeholder | ||
|
||
# Euler's equation for rigid body rotation: a = I^(-1) (T - w x (Iw)) | ||
# a = angular acceleration, I = inertia matrix, T = torque vector, w = angular velocity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Torque is only due to disturbances for the moment. I would add a comment including TODO for future implementations considering additional control torques due to actuators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
p = body_to_rpy(self._actor_pointing_vector_body, self._actor_attitude_in_rad) | ||
return x, y, z, p | ||
|
||
def update_attitude(self, dt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure this function is always called inside PASEOS main loop to be sure the variables will be updated all at the same time:
Line 123 in e5bb071
while self._state.time < target_time: |
Description
An attitude model is added, simulating the evolution of a spacecraft actor attitude through time with external attitude disturbances. User can specify initial contitions: spacecraft attitude (being roll, pitch and yaw angles) and angular velocity.
Disturbance torque calulations are not implemented yet but framework is present for later implementation.
Reference frame transfer file is also made in utils, able to switch between Earth-centered inertial, roll pitch yaw (based on nadir & along track directions) and body fixed frames. Also used for vector rotations in reference frames and extracting roll, pitch, and yaw angles between frames.
Summary of changes
Resolved Issues
How Has This Been Tested?
I made a file which plots the pointing vector in the spacecraft trajectory using matplotlib. I was not sure if I needed to add this in the PR. Please refer to my fork to file "test_attitude_plotting.py" for visual reference.
Further testing methods will be added after feedback is received.