Earth and Mars observation using periodic orbits