Skip to content

Commit

Permalink
Add planet_rotation namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
200km committed Jul 20, 2024
1 parent f539e9b commit 05d4687
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/environment/global/moon_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void MoonRotation::Update(const SimulationTime& simulation_time) {
if (mode_ == MoonRotationMode::kSimple) {
math::Vector<3> moon_position_eci_m = celestial_information_.GetPositionFromSelectedBody_i_m("MOON", "EARTH");
math::Vector<3> moon_velocity_eci_m_s = celestial_information_.GetVelocityFromSelectedBody_i_m_s("MOON", "EARTH");
dcm_j2000_to_mcmf_ = CalcDcmEciToPrincipalAxis(moon_position_eci_m, moon_velocity_eci_m_s);
dcm_j2000_to_mcmf_ = planet_rotation::CalcDcmEciToPrincipalAxis(moon_position_eci_m, moon_velocity_eci_m_s);
} else if (mode_ == MoonRotationMode::kIauMoon) {
ConstSpiceChar from[] = "J2000";
ConstSpiceChar to[] = "IAU_MOON";
Expand Down
4 changes: 4 additions & 0 deletions src/math_physics/planet_rotation/moon_rotation_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <math_physics/math/constants.hpp>

namespace planet_rotation {

math::Matrix<3, 3> CalcDcmEciToPrincipalAxis(const math::Vector<3> moon_position_eci_m, const math::Vector<3> moon_velocity_eci_m_s) {
math::Matrix<3, 3> dcm_eci2me = CalcDcmEciToMeanEarth(moon_position_eci_m, moon_velocity_eci_m_s);
math::Matrix<3, 3> dcm_me2pa = CalcDcmMeanEarthToPrincipalAxis();
Expand Down Expand Up @@ -46,3 +48,5 @@ math::Matrix<3, 3> CalcDcmMeanEarthToPrincipalAxis() {

return dcm_me_pa;
}

} // namespace planet_rotation
4 changes: 4 additions & 0 deletions src/math_physics/planet_rotation/moon_rotation_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "math_physics/math/matrix.hpp"
#include "math_physics/math/vector.hpp"

namespace planet_rotation {

/**
* @fn CalcDcmEciToPrincipalAxis
* @brief Calculate DCM from ECI to PA (Principal Axis) moon fixed frame
Expand All @@ -34,4 +36,6 @@ math::Matrix<3, 3> CalcDcmEciToMeanEarth(const math::Vector<3> moon_position_eci
*/
math::Matrix<3, 3> CalcDcmMeanEarthToPrincipalAxis();

} // namespace planet_rotation

#endif // S2E_LIBRARY_PLANET_ROTATION_MOON_MEAN_EARTH_PRINCIPAL_AXIS_FRAME_HPP_

0 comments on commit 05d4687

Please sign in to comment.