5
$\begingroup$

I have my position and velocity vectors, and also the mass and position of the sun. I need to convert my vectors to the Keplerian Orbit elements, but I can't get a definite number when I do. The orbit isn't changing, yet the 'constant' values I'm calculating are.

I've been reading this and others such as this.

I first calculate the angular momentum with $\vec{h} = \vec{r} \times \vec{v}$. This value changes as the planet goes around the orbit.

Then I calculate the eccentricity with $$\vec{e} = \frac{(v^2-\mu /r)\vec{r}-(\vec{r} \cdot \vec{v})\vec{v}}{\mu}$$

But this changes between 0.9 and 1.1 as the planet orbits, which as far as I'm aware, shouldn't happen. What is going wrong? Perhaps I'm missing something, but surely the calculations I have say that the orbit changes from an ellipse to a hyperbola, and back again.

Any help would be appreciated, thanks.

$\endgroup$
8
  • 3
    $\begingroup$ The specific angular momentum vector, the eccentricity vector, and the specific energy (you didn't mention that last one) are all constants of motion. They do not change over the orbit. What are you doing to get the $\vec{r}$ and $\vec{v}$ values around the orbit? $\endgroup$
    – Mark Adler
    Jul 9, 2015 at 14:51
  • $\begingroup$ Are you using a barycentric frame of reference? $\endgroup$
    – fibonatic
    Jul 9, 2015 at 14:52
  • $\begingroup$ To get the the r and v vectors, I'm just taking them from the object (using rigidbody.position, and rigibody.velocity). My velocity vector is changing as I'm applying force, in the direction vector x (which directs towards the sun). Does that affect why this is changing? And I'm not sure about the barycentric frame of reference, I'm just using a grid coordinate system (If that's what you mean) $\endgroup$ Jul 9, 2015 at 15:05
  • $\begingroup$ Barycentric frame of reference means that the origin of the coordinate system lies at the center of mass, therefore momentum of all bodies is zero, such that the center of mass does not move away from the origin of the coordinate system. $\endgroup$
    – fibonatic
    Jul 9, 2015 at 15:21
  • 2
    $\begingroup$ "My velocity vector is changing as I'm applying force, in the direction vector x (which directs towards the sun)" x is always towards the Sun? Is your force proportional to the inverse square of the distance from the Sun? It sounds like you're implementing the physics yourself, so you need to make sure that it's correct. $\endgroup$
    – Mark Adler
    Jul 10, 2015 at 1:31

2 Answers 2

1
$\begingroup$

I suspect your problem is that you are using the altitude of the object, and not the distance from it's center. Make sure you are using the distance to the center of the object, and I believe your problem will resolve itself.

$\endgroup$
1
  • $\begingroup$ Yes. Another mistake that can cause this is not using consistent units for r, v, and mu. $\endgroup$ Feb 4, 2016 at 0:31
0
$\begingroup$

May be a bit late, but I believe if you are using surface velocity, you get such errors. You have to use orbital velocity.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.