Skip to content

Commit

Permalink
Fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
200km committed Oct 9, 2023
2 parents b7111a6 + f0b6590 commit 956c3df
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/disturbances/air_drag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void AirDrag::Update(const LocalEnvironment& local_environment, const Dynamics&
double air_density_kg_m3 = local_environment.GetAtmosphere().GetAirDensity_kg_m3();

libra::Matrix<3, 3> dcm_ecef2eci =
local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToXcxf().Transpose();
local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef().Transpose();
libra::Vector<3> relative_velocity_wrt_atmosphere_i_m_s = dcm_ecef2eci * dynamics.GetOrbit().GetVelocity_ecef_m_s();
libra::Quaternion quaternion_i2b = dynamics.GetAttitude().GetQuaternion_i2b();
libra::Vector<3> velocity_b_m_s = quaternion_i2b.FrameConversion(relative_velocity_wrt_atmosphere_i_m_s);
Expand Down
2 changes: 1 addition & 1 deletion src/disturbances/geopotential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void Geopotential::Update(const LocalEnvironment &local_environment, const Dynam
UNUSED(time_ms_);
#endif

libra::Matrix<3, 3> trans_eci2ecef_ = local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToXcxf();
libra::Matrix<3, 3> trans_eci2ecef_ = local_environment.GetCelestialInformation().GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef();
libra::Matrix<3, 3> trans_ecef2eci = trans_eci2ecef_.Transpose();
acceleration_i_m_s2_ = trans_ecef2eci * acceleration_ecef_m_s2_;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dynamics/orbit/orbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ libra::Quaternion Orbit::CalcQuaternion_i2lvlh() const {
}

void Orbit::TransformEciToEcef(void) {
libra::Matrix<3, 3> dcm_i_to_xcxf = celestial_information_->GetEarthRotation().GetDcmJ2000ToXcxf();
libra::Matrix<3, 3> dcm_i_to_xcxf = celestial_information_->GetEarthRotation().GetDcmJ2000ToEcef();
spacecraft_position_ecef_m_ = dcm_i_to_xcxf * spacecraft_position_i_m_;

// convert velocity vector in ECI to the vector in ECEF
Expand Down
10 changes: 5 additions & 5 deletions src/environment/global/earth_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

// Default constructor
EarthRotation::EarthRotation(const EarthRotationMode rotation_mode) : rotation_mode_(rotation_mode) {
dcm_j2000_to_xcxf_ = libra::MakeIdentityMatrix<3>();
dcm_teme_to_xcxf_ = dcm_j2000_to_xcxf_;
dcm_j2000_to_ecef_ = libra::MakeIdentityMatrix<3>();
dcm_teme_to_ecef_ = dcm_j2000_to_ecef_;
InitializeParameters();
}

Expand Down Expand Up @@ -105,7 +105,7 @@ void EarthRotation::InitializeParameters() {
c_z_rad_[2] = 0.018203 * libra::arcsec_to_rad; // [rad/century^3]
} else {
// If the rotation mode is neither Simple nor Full, disable the rotation calculation and make the DCM a unit matrix
dcm_j2000_to_xcxf_ = libra::MakeIdentityMatrix<3>();
dcm_j2000_to_ecef_ = libra::MakeIdentityMatrix<3>();
}
}

Expand Down Expand Up @@ -143,11 +143,11 @@ void EarthRotation::Update(const double julian_date) {
dcm_polar_motion = PolarMotion(x_p, y_p);

// Total orientation
dcm_j2000_to_xcxf_ = dcm_polar_motion * dcm_rotation * dcm_nutation * dcm_precession;
dcm_j2000_to_ecef_ = dcm_polar_motion * dcm_rotation * dcm_nutation * dcm_precession;
} else if (rotation_mode_ == EarthRotationMode::kSimple) {
// In this case, only Axial Rotation is executed, with its argument replaced from G'A'ST to G'M'ST
// FIXME: Not suitable when the center body is not the earth
dcm_j2000_to_xcxf_ = AxialRotation(gmst_rad);
dcm_j2000_to_ecef_ = AxialRotation(gmst_rad);
} else {
// Leave the DCM as unit Matrix(diag{1,1,1})
return;
Expand Down
17 changes: 8 additions & 9 deletions src/environment/global/earth_rotation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef S2E_ENVIRONMENT_GLOBAL_EARTH_ROTATION_HPP_
#define S2E_ENVIRONMENT_GLOBAL_EARTH_ROTATION_HPP_

#include "library/logger/loggable.hpp"
#include "library/math/matrix.hpp"

/**
Expand Down Expand Up @@ -43,23 +42,23 @@ class EarthRotation {
void Update(const double julian_date);

/**
* @fn GetDcmJ2000ToXcxf
* @brief Return the DCM between J2000 inertial frame and the frame of fixed to the target object X (X-Centered X-Fixed)
* @fn GetDcmJ2000ToEcef
* @brief Return the DCM between J2000 inertial frame and the Earth Centered Earth Fixed frame
*/
inline const libra::Matrix<3, 3> GetDcmJ2000ToXcxf() const { return dcm_j2000_to_xcxf_; };
inline const libra::Matrix<3, 3> GetDcmJ2000ToEcef() const { return dcm_j2000_to_ecef_; };

/**
* @fn GetDcmTemeToXcxf
* @brief Return the DCM between TEME (Inertial frame used in SGP4) and the frame of fixed to the target object X (X-Centered X-Fixed)
* @fn GetDcmTemeToEcef
* @brief Return the DCM between TEME (Inertial frame used in SGP4) and the Earth Centered Earth Fixed frame
*/
inline const libra::Matrix<3, 3> GetDcmTemeToXcxf() const { return dcm_teme_to_xcxf_; };
inline const libra::Matrix<3, 3> GetDcmTemeToEcef() const { return dcm_teme_to_ecef_; };

private:
double d_psi_rad_; //!< Nutation in obliquity [rad]
double d_epsilon_rad_; //!< Nutation in longitude [rad]
double epsilon_rad_; //!< Mean obliquity of the ecliptic [rad]
libra::Matrix<3, 3> dcm_j2000_to_xcxf_; //!< Direction Cosine Matrix J2000 to XCXF(X-Centered X-Fixed)
libra::Matrix<3, 3> dcm_teme_to_xcxf_; //!< Direction Cosine Matrix TEME to XCXF(X-Centered X-Fixed)
libra::Matrix<3, 3> dcm_j2000_to_ecef_; //!< Direction Cosine Matrix J2000 to ECEF
libra::Matrix<3, 3> dcm_teme_to_ecef_; //!< Direction Cosine Matrix TEME to ECEF
EarthRotationMode rotation_mode_; //!< Designation of dynamics model

// Definitions of coefficients
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/ground_station/ground_station.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void GroundStation::Initialize(const SimulationConfiguration* configuration, con
void GroundStation::LogSetup(Logger& logger) { logger.AddLogList(this); }

void GroundStation::Update(const EarthRotation& celestial_rotation, const Spacecraft& spacecraft) {
libra::Matrix<3, 3> dcm_ecef2eci = celestial_rotation.GetDcmJ2000ToXcxf().Transpose();
libra::Matrix<3, 3> dcm_ecef2eci = celestial_rotation.GetDcmJ2000ToEcef().Transpose();
position_i_m_ = dcm_ecef2eci * position_ecef_m_;

is_visible_[spacecraft.GetSpacecraftId()] = CalcIsVisible(spacecraft.GetDynamics().GetOrbit().GetPosition_ecef_m());
Expand Down

0 comments on commit 956c3df

Please sign in to comment.