I am working on a satellite simulator for a project/game and I am stuck on this one bit of physics. So far I have a satellite that revolves around earth on a 2D plane following Keplerian motion using Kepler's equation. Everything is fine and the satellite will orbit many times without problem. I can also change the velocity of the satellite to manipulate apo/peri points as well as augment of periapsis.
However, the problem occurs if I change the velocity once the satellite passes the PI/2
mark, the entire orbit gets flipped (augment of periapsis is offset by PI
) and the true anomaly resets to 0.
Here is how it is currently implemented: With the assumption that the satellite starts at the periapsis at t0, I find the eccentric and true anomaly given a time since periapsis w. Then I find the radius at that angle to get the final position.
t0=0
When I update the velocity of the satellite (flight path angle ϕ is recomputed after change in velocity), I recalculate a new true anomaly using ϕ, I then find the difference between the old true anomaly and the new true anomaly, and add that to the augment of periapsis w. After that I recompute time since periapsis t using the new true anomaly and recompute the orbital parameters as well.
vel=√GM2r−1a
I noticed if I were to v=v+π if ever v2<0 and v>0, then the weird orbit/position flip won't occur until the v=π Otherwise I do not know what the problem is. I would really appreciate it if someone can point me the way, as I have been scratching my head over this for a long time now.
Answer
A quick note, your equation for the radius r as a function of the true anomaly is missing the semi-major axis a. I prefer to use the symbol θ for the true anomaly instead of v, since I will use that for the total velocity. So: r(θ)=a(1−e2)1+ecosθ
From this you can calculate the true anomaly via: θ=cos−1(a(1−e2)−rer)
No comments:
Post a Comment