Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update s2e-core pre v8 #91

Closed
wants to merge 13 commits into from
24 changes: 14 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cmake_minimum_required(VERSION 3.13)
# build config
option(USE_HILS "Use HILS" OFF)
option(USE_C2A "Use C2A" ON)
option(USE_C2A_COMMAND_SENDER "Use command sender to C2A" ON)

# preprocessor
if(WIN32)
Expand Down Expand Up @@ -80,7 +81,11 @@ add_subdirectory(${S2E_CORE_DIR}/src/disturbances s2e_core/disturbances)
add_subdirectory(${S2E_CORE_DIR}/src/dynamics s2e_core/dynamics)
add_subdirectory(${S2E_CORE_DIR}/src/environment/global s2e_core/environment/global)
add_subdirectory(${S2E_CORE_DIR}/src/environment/local s2e_core/environment/local)
add_subdirectory(${S2E_CORE_DIR}/src/library s2e_core/library)
add_subdirectory(${S2E_CORE_DIR}/src/math_physics s2e-core/math_physics)
add_subdirectory(${S2E_CORE_DIR}/src/setting_file_reader s2e-core/setting_file_reader)
add_subdirectory(${S2E_CORE_DIR}/src/logger s2e-core/logger)
add_subdirectory(${S2E_CORE_DIR}/src/utilities s2e-core/utilities)
add_subdirectory(${S2E_CORE_DIR}/ExtLibraries/inih s2e-core/inih)
add_subdirectory(${S2E_CORE_DIR}/src/simulation s2e_core/simulation)

# Add all cpp files as SOURCE_FILES
Expand Down Expand Up @@ -138,13 +143,14 @@ set(S2E_LIBRARIES
IGRF WRAPPER_NRLMSISE00 INIH SGP4 UTIL OPTICS RELATIVE_ORBIT_MODELS ORBIT_MODELS GEODESY MATH
)
# Initialize link
target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY)
target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION LIBRARY)
target_link_libraries(DISTURBANCE DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY)
target_link_libraries(SIMULATION DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT DISTURBANCE LIBRARY)
target_link_libraries(GLOBAL_ENVIRONMENT ${CSPICE_LIB} LIBRARY)
target_link_libraries(LOCAL_ENVIRONMENT GLOBAL_ENVIRONMENT ${CSPICE_LIB} LIBRARY)
target_link_libraries(LIBRARY ${NRLMSISE00_LIB})
target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT MATH_PHYSICS SETTING_FILE_READER LOGGER UTILITIES)
target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION MATH_PHYSICS)
target_link_libraries(DISTURBANCE DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT MATH_PHYSICS)
target_link_libraries(SIMULATION DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT DISTURBANCE MATH_PHYSICS)
target_link_libraries(GLOBAL_ENVIRONMENT ${CSPICE_LIB} MATH_PHYSICS)
target_link_libraries(LOCAL_ENVIRONMENT GLOBAL_ENVIRONMENT ${CSPICE_LIB} MATH_PHYSICS)
target_link_libraries(MATH_PHYSICS ${NRLMSISE00_LIB})
target_link_libraries(SETTING_FILE_READER INIH)

target_link_libraries(${PROJECT_NAME} DYNAMICS)
target_link_libraries(${PROJECT_NAME} DISTURBANCE)
Expand All @@ -167,8 +173,6 @@ if(USE_HILS)
set_target_properties(SIMULATION PROPERTIES COMMON_LANGUAGE_RUNTIME "")
set_target_properties(GLOBAL_ENVIRONMENT PROPERTIES COMMON_LANGUAGE_RUNTIME "")
set_target_properties(LOCAL_ENVIRONMENT PROPERTIES COMMON_LANGUAGE_RUNTIME "")
set_target_properties(HILS_IO PROPERTIES COMMON_LANGUAGE_RUNTIME "")
set_target_properties(RELATIVE_INFO PROPERTIES COMMON_LANGUAGE_RUNTIME "")
endif()

## Cmake debug
Expand Down
36 changes: 15 additions & 21 deletions data/initialize_files/components/oem7600.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,31 @@ antenna_position_b_m(0) = 0.0125
antenna_position_b_m(1) = 0.0000
antenna_position_b_m(2) = 0.1815

// Quaternion from body frame to component frame
// Quaternion from body frame to component frame of the antenna
// Note: The antenna boresight direction is +Z direction at the component frame
quaternion_b2c(0) = 0.0
quaternion_b2c(1) = 0.0
quaternion_b2c(2) = 0.0
quaternion_b2c(3) = 1.0

// Antenna model
// 0... simple model : GNSS sats are visible when antenna directs anti-earth direction
// 1... cone model : GNSS sats visible when a sat is in a cone
antenna_model = 0
// SIMPLE: We assume that GNSS satellites are visible when antenna directs anti-earth direction
// CONE: We calculate the number of GNSS satellites in the antenna,
// and the position is observable when more than 4 satellites are in the antenna.
// Note : We need to enable the GNSS satellite calculation when we use this mode.
// All satellites managed in the GnssSatellite class are used in this model.
antenna_model = SIMPLE

// Antenna half width [deg]
antenna_half_width_deg = 60

// Number of channels
maximum_channel = 12

// GNSS ID
// G...GPS
// R...GLONASS
// E...Galileo
// C...Beidou
// J...QZSS
// if your receiver is compatible with all kind of gnss satellites : GRECJ
// if your receiver is compatible with GPS and QZSS : GJ
gnss_id = GJ

//Random noise [m]
white_noise_standard_deviation_eci_m(0) = 1.5
white_noise_standard_deviation_eci_m(1) = 1.5
white_noise_standard_deviation_eci_m(2) = 1.5
// Random noise for simple position observation
white_noise_standard_deviation_position_ecef_m(0) = 2000.0
white_noise_standard_deviation_position_ecef_m(1) = 1000.0
white_noise_standard_deviation_position_ecef_m(2) = 1500.0
white_noise_standard_deviation_velocity_ecef_m_s(0) = 1.0
white_noise_standard_deviation_velocity_ecef_m_s(1) = 1.5
white_noise_standard_deviation_velocity_ecef_m_s(2) = 2.0

[POWER_PORT]
minimum_voltage_V = 3.3
Expand Down
2 changes: 1 addition & 1 deletion data/initialize_files/local_environment.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[MAGNETIC_FIELD_ENVIRONMENT]
calculation = ENABLE
logging = ENABLE
coefficient_file = CORE_DIR_FROM_EXE/src/library/external/igrf/igrf13.coef
coefficient_file = CORE_DIR_FROM_EXE/src/math_physics/geomagnetic/igrf13.coef
magnetic_field_random_walk_standard_deviation_nT = 10.0
magnetic_field_random_walk_limit_nT = 400.0
magnetic_field_white_noise_standard_deviation_nT = 50.0
Expand Down
2 changes: 1 addition & 1 deletion s2e-core
Submodule s2e-core updated 318 files
2 changes: 1 addition & 1 deletion src/component/aocs/aobc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "aobc.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

#include "../../simulation/spacecraft/aocs_module_components.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/component/aocs/mpu9250_gyro_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include "mpu9250_gyro_sensor.hpp"

#include <library/math/constants.hpp>
#include <library/utilities/macros.hpp>
#include <math_physics/math/constants.hpp>
#include <utilities/macros.hpp>

Mpu9250GyroSensor::Mpu9250GyroSensor(GyroSensor gyro, const int sils_port_id, const unsigned int hils_port_id, const unsigned char i2c_address,
OnBoardComputer *obc, HilsPortManager *hils_port_manager)
Expand Down
2 changes: 1 addition & 1 deletion src/component/aocs/mpu9250_magnetometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "mpu9250_magnetometer.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

Mpu9250Magnetometer::Mpu9250Magnetometer(Magnetometer magnetometer, const int sils_port_id, const unsigned int hils_port_id,
const unsigned char i2c_address, OnBoardComputer *obc, HilsPortManager *hils_port_manager,
Expand Down
2 changes: 1 addition & 1 deletion src/component/aocs/mtq_seiren.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "mtq_seiren.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

MtqSeiren::MtqSeiren(Magnetorquer magnetorquer, std::vector<int> gpio_ports, OnBoardComputer *obc)
: Magnetorquer(magnetorquer), GpioConnectionWithObc(gpio_ports, obc) {}
Expand Down
4 changes: 2 additions & 2 deletions src/component/aocs/nano_ssoc_d60.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <string.h> // for memcpy

#include <algorithm>
#include <library/math/constants.hpp>
#include <library/utilities/macros.hpp>
#include <math_physics/math/constants.hpp>
#include <utilities/macros.hpp>

NanoSsocD60::NanoSsocD60(SunSensor sun_sensor, const int sils_port_id, const unsigned int hils_port_id, const unsigned char i2c_address,
OnBoardComputer *obc, HilsPortManager *hils_port_manager)
Expand Down
14 changes: 7 additions & 7 deletions src/component/aocs/oem7600.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "oem7600.hpp"

#include <algorithm> // toupper
#include <library/utilities/macros.hpp>
#include <locale>
#include <utilities/macros.hpp>

#define MAX_CMD_LEN 1024 // TBD
#define MAX_TLM_LEN 1024 // TBD
Expand Down Expand Up @@ -66,15 +66,15 @@ void Oem7600::UpdateLocal() {
// should be modified to add noise in the future
Vector<3> pos_true_ecef_m = dynamics_->GetOrbit().GetPosition_ecef_m();
velocity_ecef_m_s_ = dynamics_->GetOrbit().GetVelocity_ecef_m_s();
position_llh_ = dynamics_->GetOrbit().GetLatLonAlt();
geodetic_position_ = dynamics_->GetOrbit().GetGeodeticPosition();
AddNoise(pos_true_eci_m, pos_true_ecef_m);

last_position_fix_time_local_ = simulation_time_->GetElapsedTime_s(); // store position fixed time [sec]
utc_ = simulation_time_->GetCurrentUtc();
ConvertJulianDayToGPSTime(simulation_time_->GetCurrentTime_jd());
ConvertJulianDayToGpsTime(simulation_time_->GetCurrentTime_jd());
} else {
utc_ = simulation_time_->GetCurrentUtc();
ConvertJulianDayToGPSTime(simulation_time_->GetCurrentTime_jd());
ConvertJulianDayToGpsTime(simulation_time_->GetCurrentTime_jd());
}
}

Expand Down Expand Up @@ -748,10 +748,10 @@ std::string Oem7600::GenerateGpggaTelemetry(void) {
str_tmp += StringZeroPaddingLocal(str_utc_tmp, 6);

// lat in [ddmm.mm] + indicator "N" or "S"
str_tmp += ConvLatLonToNmea(position_llh_[0], "lat");
str_tmp += ConvLatLonToNmea(geodetic_position_.GetLatitude_rad(), "lat");

// lon in [dddmm.mm] + indicator "E" or "W"
str_tmp += ConvLatLonToNmea(position_llh_[1], "lon");
str_tmp += ConvLatLonToNmea(geodetic_position_.GetLongitude_rad(), "lon");

// quality
if (is_gnss_visible_) {
Expand All @@ -767,7 +767,7 @@ std::string Oem7600::GenerateGpggaTelemetry(void) {
str_tmp += "1.0,";

// alt in [m]
str_tmp += WriteScalar(position_llh_[2]);
str_tmp += WriteScalar(geodetic_position_.GetAltitude_m());

// units of alt(fix to M in default)
str_tmp += "M,";
Expand Down
2 changes: 1 addition & 1 deletion src/component/aocs/rm3100.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "rm3100.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

Rm3100::Rm3100(Magnetometer magnetometer, const int sils_port_id, const unsigned int hils_port_id, const unsigned char i2c_address,
OnBoardComputer *obc, HilsPortManager *hils_port_manager)
Expand Down
4 changes: 2 additions & 2 deletions src/component/aocs/rw0003.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <math.h>

#include <library/utilities/macros.hpp>
#include <library/utilities/slip.hpp>
#include <utilities/macros.hpp>
#include <utilities/slip.hpp>

Rw0003::Rw0003(ReactionWheel rw, const int sils_port_id, const unsigned int hils_port_id, const unsigned char i2c_address, OnBoardComputer *obc,
HilsPortManager *hils_port_manager)
Expand Down
2 changes: 1 addition & 1 deletion src/component/aocs/sagitta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "sagitta.hpp"

#include <library/utilities/slip.hpp>
#include <utilities/slip.hpp>

Sagitta::Sagitta(StarSensor stt, const int sils_port_id, OnBoardComputer *obc) : StarSensor(stt), UartCommunicationWithObc(sils_port_id, obc) {}

Expand Down
2 changes: 1 addition & 1 deletion src/component/aocs/stim210.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "stim210.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

Stim210::Stim210(GyroSensor gyro, double compo_step_sec, const int sils_port_id, OnBoardComputer *obc)
: GyroSensor(gyro), UartCommunicationWithObc(sils_port_id, obc), counter_(0), compo_step_sec_(compo_step_sec) {}
Expand Down
4 changes: 2 additions & 2 deletions src/component/power/power_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "power_controller.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

#include "../../simulation/spacecraft/aocs_module_port_config.hpp"

Expand Down Expand Up @@ -45,7 +45,7 @@ void PowerController::MainRoutine(const int time_count) {
#ifdef USE_HILS // TODO GPIO操作もHILSでできるようになったら削除する
for (int i = 0; i < (int)PowerPortIdx::MAX; i++) {
PowerPort *power_port = GetPowerPort(i);
power_port->SetVoltage(output_voltage_list_[i]);
power_port->SetVoltage_V(output_voltage_list_[i]);
}
return;
#else
Expand Down
2 changes: 1 addition & 1 deletion src/interface/hils/hils_if_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "hils_if_driver.hpp"

#include <library/utilities/macros.hpp>
#include <utilities/macros.hpp>

HilsIfDriver::HilsIfDriver(const int prescaler, ClockGenerator *clock_generator, const unsigned int hils_port_id, const unsigned int baud_rate,
HilsPortManager *hils_port_manager, std::vector<int> gpio_ports, OnBoardComputer *obc)
Expand Down
4 changes: 2 additions & 2 deletions src/s2e_aobc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <string>

// Simulator includes
#include <library/logger/initialize_log.hpp>
#include <library/utilities/macros.hpp>
#include <logger/initialize_log.hpp>
#include <simulation/monte_carlo_simulation/initialize_monte_carlo_simulation.hpp>
#include <utilities/macros.hpp>

// Add custom include files
#include "./simulation/case/sample_case.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/spacecraft/aocs_module_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "aocs_module_components.hpp"

#include <components/real/power/csv_scenario_interface.hpp>
#include <library/initialize/initialize_file_access.hpp>
#include <setting_file_reader/initialize_file_access.hpp>
#include <vector>

#include "../../component/aocs/aobc.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/spacecraft/aocs_module_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define S2E_AOBC_SIMULATION_SPACECRAFT_AOCS_MODULE_COMPONENTS_HPP_

#include <dynamics/dynamics.hpp>
#include <library/math/vector.hpp>
#include <math_physics/math/vector.hpp>
#include <simulation/spacecraft/installed_components.hpp>

// CDH
Expand Down