- Joined
- Jul 5, 2021
- Messages
- 730
- Reaction score
- 1,139
- Points
- 108
- Location
- Cislunar Space
- Website
- www.orbiter-forum.com
So I am working on a project (Lunar Rover) where the HGA needs to be kept pointed at the earth. I have the code to drive the HGA to working, and I can make it stay pointed at any celestial body... EXCEPT Earth!
Here is my code:
This makes the HGA point at the sun, not earth!
If I change the 'oapiGetGbodyByName("Earth")' to, say 'oapiGetGbodyByName("Jupiter")' than it points at Jupiter as I would expect.
Same for anything but Earth! Mars works correctly, etc. Just not Earth, which, unfortunately is the one place in the solar system I need to send a signal to!
Here is my code:
C++:
VECTOR3 rearth;
VECTOR3 rearthinv;
VECTOR3 rearthloc;
oapiGetRelativePos(GetHandle(), oapiGetGbodyByName("Earth"), &rearth);
rearthinv = _V(-rearth.x, -rearth.y, -rearth.z);
Global2Local(rearthinv, rearthloc);
//These are the functions that actually move the HGA
HGAAzimuth(simdt, rearthloc);
HGAElevation(simdt, rearthloc);
This makes the HGA point at the sun, not earth!
If I change the 'oapiGetGbodyByName("Earth")' to, say 'oapiGetGbodyByName("Jupiter")' than it points at Jupiter as I would expect.
Same for anything but Earth! Mars works correctly, etc. Just not Earth, which, unfortunately is the one place in the solar system I need to send a signal to!