NCSU-High-Powered-Rocketry-Club / High-Powered-Rocketry-Modeling

Tools for simulating and modeling the flights of high powered rockets.
3 stars 0 forks source link

State Generality #2

Closed MrPezser closed 4 days ago

MrPezser commented 6 days ago

Current the math_mod routines are hardcoded for the current state (1D state space w/ height and velocity). This needs to be generalized with the help of additional routines in the state_module. Additionally, it would be good to include different options for the state space, maybe not fully fleshed out, but just getting them there so people can see them.

Current idea is to define general state functions under "impl State {}" and use match statements to handle differences between the states. OPEN QUESTION is if states should be structs in and of themselves, or if they should just be arrays/tuples. I'm going to try to implement them as arrays handled by the State enum since that means the fewest layers of abstraction, but I could see the desire to put them in structs later.

MrPezser commented 4 days ago

Current Implementation of this is that "State" is an enum whose variants take the different state space structures as arguments. Each state space is a structure which defines the information it needs. Specifically the state vectors themselves have a specific type (Ex: [f64; 2]). In order for external functions to interact with the states in a general manner, a second enum "State Vector" is made. The variants of StateVector have the same name as the variants of State, and their field is a type specifier (Ex: __1DOF([f64; 2]))