Malex21 / CreateBigCannons-BallisticCalculator

A python program that will give you the right orientations in order for your cannon to hit a target
GNU General Public License v3.0
9 stars 3 forks source link

Pitch calculation is completely fucked #6

Open UndeadOrb opened 1 month ago

UndeadOrb commented 1 month ago

Trajectory calculation for pitch angle does not function as expected. Calculation returns maximum range values at exceptionally low, approaching 0-degree values, when it should be approaching ~30 degrees due to optimal angle (45) with inclusion of drag subtracting it.

UndeadOrb commented 1 month ago

To add to this, the calculator seems to diverge completely from reality after the Traj 1/2 pitches both equal approximately 32 degrees, which (generally) represents true maximum range. Any calculations after this point typically leans towards returning two identical values that trend closer and closer to pitch=0 deg, which is wildly inaccurate. Manually truncating these false values by returning a "cannot reach this target" comment whenever the calculator returns two identical pitch values below 31 degrees would potentially solve this problem.

You can see the problem develop by walking the range up by one block at a time- the indirect and direct fire pitch recommendations will ultimately overlap, then begin trending lower and lower erroneously. Once these two values have become equal, the calculations returned become increasingly inaccurate.

This value does become lower as the charge count increases- 8 charge nethersteel cannons will max out at around 25.5 deg, so some discretion would be needed when adding a truncation value- but checking for two identical pitch values would be a fairly consistent way to truncate these erroneous values.

Malex21 commented 3 weeks ago

Hello ! Sorry for the late response, I have been very busy with my studies. Just wanted to let you know that I've read your issue, thank you btw for posting it. I thought that the program would always give "Out of range" if the cannon was too far away from the target ; I do remember an issue that came up while making it, which made the results very veru inaccurate if the target was slightly out of range (maybe I forgot to fix it, I don't remember honestly) I will look into it when I get some time, thank you again for posting

UndeadOrb commented 3 weeks ago

No problem, the issue seems to occur regardless of cannon yaw and initial compass direction- it seems exclusive to pitch as the absolute distance to target increases. I'd recommend setting up a simple test rig mockup in the calculator and walking the range out slowly until you see the problem I reported- you'll see it only begin reporting "cannot reach" when returned pitch would be would be less than zero, rather than the correct max range that occurs at somewhere between 45-25.5 degrees.