Skip to content

Commit

Permalink
Merge pull request #713 from ut-issl/feature/move-example-user-dir
Browse files Browse the repository at this point in the history
Move & isolate example user dir
  • Loading branch information
sksat authored Jan 27, 2025
2 parents c6bc997 + c10953c commit 244f0bd
Show file tree
Hide file tree
Showing 68 changed files with 64 additions and 54 deletions.
62 changes: 33 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ on:
paths:
- '.github/workflows/build.yml'
- 'ExtLibraries/**'
- 'CMakeLists.txt'
- 'common.cmake'
- 'CMakeSettings.json'
- 'src/**'
- 'scripts/Plot/Pipfile'
- 'example/CMakeSettings.json'
- 'example/CMakeLists.txt'
- 'example/src/**'

env:
# datasource=github-releases depName=ut-issl/c2a-core
Expand Down Expand Up @@ -113,38 +114,40 @@ jobs:
if: steps.cache-extlib.outputs.cache-hit == 'true'
shell: powershell
run: |
ls ./settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./settings/environment/cspice"
ls ./settings/environment/cspice
ls ./settings/environment/cspice/generic_kernels/lsk
ls ./settings/environment/cspice/generic_kernels/pck
ls ./settings/environment/cspice/generic_kernels/spk
- name: build 32bit
ls ./example/settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./example/settings/environment/cspice"
ls ./example/settings/environment/cspice
ls ./example/settings/environment/cspice/generic_kernels/lsk
ls ./example/settings/environment/cspice/generic_kernels/pck
ls ./example/settings/environment/cspice/generic_kernels/spk
- name: build example (32bit)
if: matrix.build_bit == 'BUILD_64BIT=OFF'
shell: cmd
working-directory: ./example
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=../ -DEXT_LIB_DIR=../ExtLibraries -DEXT_LIB_DIR_FROM_EXE=../ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: build 64bit
- name: build example (64bit)
if: matrix.build_bit == 'BUILD_64BIT=ON'
shell: cmd
working-directory: ./example
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=../ -DEXT_LIB_DIR=../ExtLibraries -DEXT_LIB_DIR_FROM_EXE=../ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
shell: bash
working-directory: ./settings
working-directory: ./example/settings
run: |
find . -type f -name '*.ini' -exec sed -i 's/..\/..\/logs/.\/logs/g' {} \;
- name: run simulation(SampleSat)
- name: run simulation (SampleSat)
if: matrix.build_bit == 'BUILD_64BIT=OFF' || (matrix.build_bit == 'BUILD_64BIT=ON' && matrix.use_c2a == 'USE_C2A=OFF')
working-directory: ./
working-directory: ./example
run: |
.\Debug\S2E.exe
Expand Down Expand Up @@ -222,29 +225,30 @@ jobs:
- name: copy to settings
if: steps.cache-extlib.outputs.cache-hit == 'true'
run: |
ls ./settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./settings/environment/cspice"
ls ./settings/environment/cspice
ls ./settings/environment/cspice/generic_kernels/lsk
ls ./settings/environment/cspice/generic_kernels/pck
ls ./settings/environment/cspice/generic_kernels/spk
ls ./example/settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./example/settings/environment/cspice"
ls ./example/settings/environment/cspice
ls ./example/settings/environment/cspice/generic_kernels/lsk
ls ./example/settings/environment/cspice/generic_kernels/pck
ls ./example/settings/environment/cspice/generic_kernels/spk
- name: build
env:
CC: ${{ steps.compiler.outputs.CC }}
CXX: ${{ steps.compiler.outputs.CXX }}
working-directory: ./example
run: |
cmake . -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -D${{ matrix.build_bit }}
cmake . -DEXT_LIB_DIR=../ExtLibraries -DEXT_LIB_DIR_FROM_EXE=../ExtLibraries -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=../ -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
working-directory: ./settings
working-directory: ./example/settings
run: |
find . -type f -name '*.ini' -exec sed -i 's/..\/..\/logs/.\/logs/g' {} \;
- name: run simulation(SampleSat)
working-directory: ./
working-directory: ./example
run: |
./S2E
Expand All @@ -253,19 +257,19 @@ jobs:
run: |
sudo apt-get install -y gnuplot
pip3 install yq
LOG=$(ls ../../logs/logs_*/*.csv)
LOG=$(ls ../../example/logs/logs_*/*.csv)
echo "plot $LOG"
./gen_graph.sh "${LOG}"
ls
ls ./imgs
- name: read python version from Pipfile
id: python-version
working-directory: ./scripts/Plot
run: |
ver=$(grep python_version ./Pipfile | sed -e 's/^python_version\s=\s"\(.*\)"$/\1/')
echo "version=$ver" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ steps.python-version.outputs.version }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/google-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ jobs:
ls nrlmsise00/lib*/libnrlmsise00.a
ls nrlmsise00/src
- name: build
- name: build example
env:
CC: ${{ steps.compiler.outputs.CC }}
CXX: ${{ steps.compiler.outputs.CXX }}
working-directory: ./example
run: |
cmake . -DEXT_LIB_DIR=./ExtLibraries -DBUILD_64BIT=ON -DGOOGLE_TEST=ON -DCORE_DIR_FROM_EXE=../s2e-core
cmake . -DEXT_LIB_DIR=../ExtLibraries -DBUILD_64BIT=ON -DGOOGLE_TEST=ON -DCORE_DIR_FROM_EXE=../s2e-core
cmake --build .
- name: run test
working-directory: ./example
run: ./S2E_TEST
42 changes: 23 additions & 19 deletions CMakeLists.txt → example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ if(WIN32)
endif()

## set directory path
if(NOT DEFINED S2E_CORE_DIR)
set(S2E_CORE_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
endif()
if(NOT DEFINED EXT_LIB_DIR)
set(EXT_LIB_DIR ../ExtLibraries)
set(EXT_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/../../ExtLibraries)
endif()
set(CSPICE_DIR ${EXT_LIB_DIR}/cspice)
set(NRLMSISE00_DIR ${EXT_LIB_DIR}/nrlmsise00)
Expand All @@ -42,7 +45,7 @@ endif()

## Directory path for ini files
if(NOT DEFINED SETTINGS_DIR_FROM_EXE)
set(SETTINGS_DIR_FROM_EXE ../../settings)
set(SETTINGS_DIR_FROM_EXE ../settings)
endif()

if(NOT DEFINED EXT_LIB_DIR_FROM_EXE)
Expand Down Expand Up @@ -79,29 +82,30 @@ endif()
set(S2E_DIR ${CMAKE_CURRENT_SOURCE_DIR})

## include directories
include_directories(${S2E_CORE_DIR}/src)
include_directories(${CSPICE_DIR}/include)
include_directories(${NRLMSISE00_DIR}/src)

## add_subdirectories
add_subdirectory(src/simulation)
add_subdirectory(src/environment/global)
add_subdirectory(src/environment/local)
add_subdirectory(src/dynamics)
add_subdirectory(src/disturbances)
add_subdirectory(src/components)
add_subdirectory(src/math_physics)
add_subdirectory(src/setting_file_reader)
add_subdirectory(src/logger)
add_subdirectory(src/utilities)
add_subdirectory(ExtLibraries/inih)
add_subdirectory(${S2E_CORE_DIR}/src/simulation simulation)
add_subdirectory(${S2E_CORE_DIR}/src/environment/global environment/global)
add_subdirectory(${S2E_CORE_DIR}/src/environment/local environment/local)
add_subdirectory(${S2E_CORE_DIR}/src/dynamics dynamics)
add_subdirectory(${S2E_CORE_DIR}/src/disturbances disturbances)
add_subdirectory(${S2E_CORE_DIR}/src/components components)
add_subdirectory(${S2E_CORE_DIR}/src/math_physics math_physics)
add_subdirectory(${S2E_CORE_DIR}/src/setting_file_reader setting_file_reader)
add_subdirectory(${S2E_CORE_DIR}/src/logger logger)
add_subdirectory(${S2E_CORE_DIR}/src/utilities utilities)
add_subdirectory(${S2E_CORE_DIR}/ExtLibraries/inih ExtLibraries/inih)

set(SOURCE_FILES
src/s2e.cpp
src/simulation_sample/case/sample_case.cpp
src/simulation_sample/spacecraft/sample_spacecraft.cpp
src/simulation_sample/spacecraft/sample_components.cpp
src/simulation_sample/ground_station/sample_ground_station_components.cpp
src/simulation_sample/ground_station/sample_ground_station.cpp
src/simulation/case/sample_case.cpp
src/simulation/spacecraft/sample_spacecraft.cpp
src/simulation/spacecraft/sample_components.cpp
src/simulation/ground_station/sample_ground_station_components.cpp
src/simulation/ground_station/sample_ground_station.cpp
)

## cspice library
Expand Down Expand Up @@ -264,4 +268,4 @@ endif()
message("Cspice_LIB: " ${CSPICE_LIB})
message("nrlmsise00_LIB: " ${NRLMSISE00_LIB})

include(common.cmake)
include(${S2E_CORE_DIR}/common.cmake)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/s2e.cpp → example/src/s2e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "logger/logger.hpp"

// Add custom include files
#include "simulation_sample/case/sample_case.hpp"
#include "simulation/case/sample_case.hpp"
// #include "simulation/monte_carlo_simulation/monte_carlo_simulation_executor.hpp"
// #include "interface/hils/COSMOSWrapper.h"
// #include "interface/hils/HardwareMessage.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef S2E_SIMULATION_SAMPLE_CASE_SAMPLE_CASE_HPP_
#define S2E_SIMULATION_SAMPLE_CASE_SAMPLE_CASE_HPP_

#include <src/simulation/case/simulation_case.hpp>
#include <simulation/case/simulation_case.hpp>

#include "../ground_station/sample_ground_station.hpp"
#include "../spacecraft/sample_spacecraft.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef S2E_SIMULATION_SAMPLE_SPACECRAFT_SAMPLE_SPACECRAFT_HPP_
#define S2E_SIMULATION_SAMPLE_SPACECRAFT_SAMPLE_SPACECRAFT_HPP_

#include <src/simulation/spacecraft/spacecraft.hpp>
#include <simulation/spacecraft/spacecraft.hpp>

#include "sample_components.hpp"

Expand Down
2 changes: 1 addition & 1 deletion scripts/Plot/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def read_scalar_from_csv(read_file_name, header_name):
return vector

def add_log_file_arguments(aparser):
aparser.add_argument('--logs-dir', type=str, help='logs directory like "../../logs"', default='../../logs')
aparser.add_argument('--logs-dir', type=str, help='logs directory like "../../example/logs"', default='../../example/logs')
aparser.add_argument('--file-tag', type=str, help='log file tag like 220627_142946')
return aparser

Expand Down

0 comments on commit 244f0bd

Please sign in to comment.