Welcome to Kiwi’s documentation!
Use the sidebar (on the left) to find lists of all the available classes and functions, for each submodule. Use the ‘home’ buttons (with the small image of a house) to navigate back to this main page.
References |
cusfkiwi.main module
References
[1] - A.M.P. Tombs, The Extended Mars Lander, Exercise 1: Euler’s equations and quaternions, September 18, 2013
- class cusfkiwi.main.Simulation(body, dt, end_condition)
Bases:
object
Class for running simulations and storing the resulting data.
- Parameters
bodies (list) – Body object to add to the simulation.
dt (float) – Timestep.
end_condition (callable) – Function of the State. Must return True when the simulation needs to end.
- states
List of State objects, containing the full state of the body at each timestep.
- Type
list
- fdot(fn, t, debug=False)
- run(debug=False)
- x()
- Returns
x coordinates
- Return type
numpy.ndarray
- y()
- Returns
y coordinates
- Return type
numpy.ndarray
- z()
- Returns
z coordinates
- Return type
numpy.ndarray
- t()
- Returns
Time values
- Return type
numpy.ndarray
- V()
- Returns
Velocity magnitudes
- Return type
numpy.ndarray
- class cusfkiwi.main.Body(init_state, mass, moments_of_inertia, forces, moments)
Bases:
object
Class for storing the inertial properties of a body as well as the forces and moments that are to be applied.
- Parameters
init_state (State) – Initial conditions as a State object.
mass (Mass) – Mass object to represent the body’s mass.
moments_of_inertia (MomentsOfInertia) – MomentsOfInertia object to represent the principal moments of inertia of the body.
forces (list) – List of Forces objects, to represent the forces on the body.
moments (list) – List of Moments objects, to represent the moments on the body.
- class cusfkiwi.main.State(time, pos, vel, ang_pos, ang_vel)
Bases:
object
Class for storing the entire state of a body (6 degrees of freedom in total).
- Parameters
time (float) – Time.
pos (list) – Position in the absolute reference frame, [x, y, z]. List or array of length 3.
vel (list) – Velocity in the absolute reference frame, [v_x, v_y, v_z]. List or array of length 3.
ang_pos (list) – Attitude in quaternion form, should be a length 4 list or array. Represents a conversion from the body reference frame to the absolute one. Can be useful to use scipy.spatial.transform.Rotation if you need help with this.
ang_vel (list) – Angular velocity in the body’s reference frame, [w_A, w_B, w_C]. List or array of length 3.
- time
Time.
- Type
float
- pos
Position in the absolute reference frame, [x, y, z].
- Type
list
- vel
Velocity in the absolute reference frame, [v_x, v_y, v_z].
- Type
list
- ang_pos
Attitude in quaternion form, should be a length 4 list or array. Represents a conversion from the body reference frame to the absolute one.
- Type
list
- ang_vel
Angular velocity in the body’s reference frame, [w_A, w_B, w_C].
- Type
list
- to_array()
- static from_array(array)
- class cusfkiwi.main.Mass(value, input='none')
Bases:
object
Class for representing the mass of a body.
- Parameters
value (float or callable) – Mass. Either a constant or a callable.
input (str, optional) – “none” for a constant, “time” to receive the time as an input, “state” to receive a State object as input. Defaults to “none”.
- class cusfkiwi.main.MomentsOfInertia(value, input='none')
Bases:
object
Class for representing the principal moments of inertia of a body. Note that these principal moments of inertia should be given in the body’s reference frame. This makes them constant for a constant mass and geometry system.
- Parameters
value (list or callable) – List of principal moments of inetia in the form [A, B, C]. Can be a constant, function of time, or function of the State.
input (str, optional) – “none” for a constant, “time” to receive the time as an input, “state” to receive a State object as input. Defaults to “none”.
- class cusfkiwi.main.Force(value, input='none')
Bases:
object
Class for representing the forces on a body. These must be given in the absolute reference frame (NOT the body reference frame).
- Parameters
value (list or callable) – Force, [F_x, F_y, F_z]. List or array of length 3. Should be in the absolute (NOT body) reference frame. Either a constant or a callable.
input (str, optional) – “none” for a constant, “time” to receive the time as an input, “state” to receive a State object as input. Defaults to “none”.
- class cusfkiwi.main.Moment(value, input='none')
Bases:
object
Class for representing the moments on a body. These must be given in the body’s reference frame (NOT the absolute one).
- Parameters
value (list or callable) – Moment, [M_A, M_B, M_C], representing components about the body’s A, B and C axes (using a right hand rule). List or array of length 3. Should be in the body reference frame (NOT the absolute one). Either a constant or a callable.
input (str, optional) – “none” for a constant, “time” to receive the time as an input, “state” to receive a State object as input. Defaults to “none”.