waterloo-rocketry / cansw_processor_stm

1 stars 0 forks source link

Trajectory estimation #19

Closed JacobG1003 closed 1 month ago

JacobG1003 commented 1 month ago

Implemented trajectory task which has queues for Extension, Altitude and Angles. Uses altitude with time to determine vertical velocity then trig with angles to get perpendicular velocity. Then calls the get_max_altitude function and stores the result in a queue.

Get_max_altitude runs RK4 until the altitude projected in the current time step is less than the previous then returns the previous.

RK4 calls the get_forces to calculate the forces in the x and y directions and applies RK4 to predict the time after 0.05s.

Get forces calls other functions to calculate drag based on extension with velocity and gravity based on altitude

The calculation of vX is different for ORK and has not been tested (probably wrong), Testing is currently not implemented you can just print out the apogee before putting it into the queue. Some values from the ORK (ext always 0) are alt = 5379.753549195324 vY = 323.1784930491833 vX = 8.950376591850105 -> Pred Apogee = 9595.908448948594

alt = 7715.322872718894 vY = 200.0230162217547 vX = 7.352890354296182 -> Pred Apogee = 9589.262553376933

alt = 9089.695027221856 vY = 99.50743088714252 vX = 6.525571391572686 -> Pred Apogee = 9587.414315909262

Final Apogee according to ORK is 9586

Joe-Joe-Joe-Joe commented 1 month ago

Code compiles so I am approving. I will be opening a new PR soon for integration with the rest of the code