The following instructions are for setting up NASA's EMTG on Mac. This repository is a forked version of the original EMTG repository and has been edited to ensure it works on Mac, assuming the rest is setup correctly as shown below. Changes that were made between this repository and the original repository may be viewed in the code itself, but details of the changes are also outlined at the end of this README. Note that these instructions confirm to work on the new Mac M1/M2 processors, but might still work on Intel processors with little to no changes.
Below are things that need to be done before EMTG can be built. It is recommended to use Homebrew to install most necessary software.
Choose appropiate OS and follow instructions (https://naif.jpl.nasa.gov/naif/toolkit_C.html)
Install GSL (brew install gsl
) and make sure the EMTG-Config.cmake' file points to its
lib` directory
Install CMake (brew install cmake
)
Install Boost if not already dont so (brew install boost
)
- Install GCC version 11 (
brew install gcc@11
) - In terminal shell profile (if using bash then
nano ~/.bashrc
, if using zshrc thennano ~/.zshrc
), add pointers to gccexport CXX=/path/to/g++-11
(for example,export CXX=/opt/homebrew/Cellar/gcc@11/11.3.0/bin/g++-11
)export CC=/path/to/gcc-11
(for example,export CC=/opt/homebrew/Cellar/gcc@11/11.3.0/bin/gcc-11
)export FC=/path/to/gfortran-11
(for example,export FC=/opt/homebrew/Cellar/gcc@11/11.3.0/bin/gfortran-11
)
- Make sure shell is updated by either quitting and reopening or running
source ~/.bashrc
(orsource ~/.zshrc
)
Install autoconf (brew install autoconf
)
- Unzip the zip flolder containing SNOPT anywhere
- Go inside SNOPT root
- Run
./configure --with-cpp
- Run
make
(warnings can be ignored) - Run
make install
- Run
make check
and ensure no errors occur - Inside SNOPT root, run
git clone https://github.com/snopt/snopt-interface.git
and rename new folder (should be/snopt-interface') to
/interfaces(with
mv snopt-interface interfaces`) - Go inside
/interfaces
- Make sure autoconf is installed (homebrew)
- Run
autoconf
, runautoupdate
if prompted then rerunautoconf
- Run
./configure --with-snopt=/path/to/your/snopt/lib
(for example,./configure --with-snopt=/Users/nick/Documents/SNOPT/snopt7/lib
) - Run
make
(ignore warnings) - Run
make install
- Run
make examples
- Clone EMTG_153 (
git clone https://github.com/RNakano1230/EMTG_153.git
) - Go to
/emtg
- Copy
EMTG-Config-template.cmake
and rename toEMTG-Config.cmake
(cp EMTG-Config-template.cmake EMTG-Config.cmake
) - In
EMTG-Config.cmake
- Set 'CSPCICE_DIR' to wherever NASA’s SPICE toolkit has been downloaded (for example,
set(CSPICE_DIR /Users/nick/Documents/SPICE/cspice)
) - Set 'SNOPT_ROOT_DIR' to point to SNOPT root location (for example,
set(SNOPT_ROOT_DIR /Users/nick/Documents/SNOPT/snopt7)
) - Comment out all Boost related settings (using
#
) - Change GSL path to wherever GSL
/lib
is (for example,set(GSL_PATH /opt/homebrew/Cellar/gsl/2.7.1/lib)
) - Change python requirement version to 3.10 (or 3.9, should still work)
- Set 'CSPCICE_DIR' to wherever NASA’s SPICE toolkit has been downloaded (for example,
- Download
randutils.hpp
(from https://gist.github.com/gnzlbg/efbacf7c668f783cd021) and put into/emtg/src/Math
- Create
build
folder in EMTG root (mkdir build
) - Go inside
/build
(cd build
) - Run
cmake ..
- Run
make
(warnings should be able to be ignored)
Standard procedures may be used for python installation and required packages (outlined in /emtg/PyEMTG/README.txt
). We note that wxpython
may require downloading a framework version of python. If using homebrew and pyenv workflow, then run env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.10.4
It may be required to run PyEMTG.py with pythonw
as opposed to just python
. It may also be required to follow instructions on this url for using a framework version of python https://matplotlib.org/3.1.0/faq/osx_framework.html.
If an error occurs when trying to run simulations from the python GUI, then it may be required to make changes in the PyEMTG_interface.py
. More specifically, check the function definition on line 357, OnRun
.
Again, follow instructions in /emtg/PyEMTG/README.txt
:
- Install proper python dependencies
- Make
PyEMTG.options
file from template (cp PyEMTG-template.options PyEMTG.options
) and update accordingly Then runpython PyEMTG.py
_ Make sure NASA's CSIPCE (https://naif.jpl.nasa.gov/naif/toolkit.html) is built for correct operating system
- Clone original EMTG repository (https://github.com/nasa/EMTG)
- Copy
EMTG-Config-template.cmake
and rename asEMTG-Config.cmake
- In
EMTG-Config.cmake
- Set 'CSPCICE_DIR' to wherever NASA’s SPICE toolkit has been downloaded (download to anywhere other than EMTG root)
- Set 'SNOPT' to point to SNOPT root location (anywhere other than EMTG root)
- Comment out all Boost related settings
- Change GSL path to wherever GSL
lib
is - Change python requirement version to 3.10 (or 3.9, should still work)
- Download
randutils.hpp
(from https://gist.github.com/gnzlbg/efbacf7c668f783cd021) and put intoemtg/src/Math/
- In
emtg/CMakeLists.txt
, change file extension in lines 206 and 207 from.so
to.dylib
- In
emtg/Utilities/file_utilities.cpp
- Comment out line 22
- Add
#include <filesystem>
- Change
namespace fs = ::boost::filesystem
tonamespace fs = std::filesystem
- In
emtg/Utilities/file_utilities.h
- Comment out lines 23 and 24
- Comment out line 29
- Add
#include <filesystem>
- Change
namespace fs = ::boost::filesystem
tonamespace fs = std::filesystem
- In
emtg/src/Executable/EMTG_v9.cpp
- Comment out line 50
- Add
#include <filesystem>
- Change all
boost::filesystem
tostd::filesystem
(use search and replace), remove all::
from::std::filesystem
where necessary
Welcome to EMTGv9 Open Source Release README.opensource file compiled by Jacob Englander 4-20-2020
This package contains all of the code that NASA GSFC is releasing for the Evolutionary Mission Trajectory Generator, version 9. No third-party code is included in this release. You will need to download the third-party components yourself. This information is detailed in documents that may be found in the docs/build_system folder.
In particular, you will need a license for SNOPT. This is not free. Many of you probably already have SNOPT, and the rest may have to purchase it. EMTGv9 is known to work with SNOPT 7.5 and 7.6. It probably also works with 7.7 but I can't verify this because I don't have a license for 7.7. Older versions might work.
You will want to download SPICE ephemeris files for the bodies that you are visiting. I recommend downloading the full 3+ GB set from http://naif.jpl.nasa.gov/naif/ and placing it in your Universe/ephemeris_files folder
Note that regardless of whether you download all of the various SPICE ephemerides for the solar system, you will need to download de430.bsp from https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430.bsp and place it in your Universe/ephemeris_files folder. I could not supply this file because it is too large for Github.
You must edit the EMTG-Config.cmake file as follows:
-
Change the CSPICE_DIR to wherever you have placed your CSPICE package. CSPICE_DIR should point to the root CSPICE directory.
-
Change the SNOPT_ROOT_DIR to be wherever you have placed the unzipped SNOPT folder. From this directory, it will seek the traditional /lib and /interface folders (as appropriate to your SNOPT version, which should be auto detected). Report any problems to the EMTG lead developers. Example: This is currently usually a directory called "snopt7"
-
Change the 'BOOST_ROOT' to the root of your boost installer. This presupposes you have already built boost (run its bootstrapper) 3a) Optionally, if during the run phase of CMAKE boost is not being found, uncomment the next two lines and specifically specify the BOOST_INCLUDEDIR and BOOST_LIBRARYDIR. The default options are traditional variants that are sometimes chosen by boost installers, but yours may vary.
Once all the above is in place, open CMake, and point the source directory at the EMTG root directory. Point the build directory to the directory of your choice (may be the same). Run configure, then Generate, as per the usual CMake Process. This will create either makefile for Linux or a Visual Studio project for Windows, or an Xcode project for Mac.
EMTGv9 is provided "as is" in its imperfect but very capable state. The US Government, NASA, and the developers cannot guarantee that the results you produce with EMTG are correct. EMTG is intended for use as a trade study tool and an initial guess generator for a flight navigation tool. We recommend that you use it in those contexts and only those contexts.