I am trying to the calculate the link budget for link between a ground station on Earth (with a particular latitude and longitude) and a rover at a particular location on the surface of Mars, either directly or through a satellite on Mars. Now, if I need to determine the link availability between the rover and the ground station, the first step is to determine weather I have a line of sight between the ground station and the rover.
For this, the first step is to determine whether Mars is above our horizon or not and if so, for how long. This can be easily done using packages such as PyEphem or Novas.
The next step would be to determine if the rover is actually facing Earth or is on the other side of Mars. It is this second step that I need to determine with reasonable accuracy, but have not been able to figure out how to so far.
Later on I would need to include the satellites in the link path as well, but for now, I need to determine if I can get a straight line of sight communication between the rover on Mars and ground station on Earth.
Any sort of help will be appreciated.