Skip to content

Commit

Permalink
Merge pull request #617 from ut-issl/feature/add_relative_velocity_di…
Browse files Browse the repository at this point in the history
…rection_pointing
  • Loading branch information
Hiro-0110 committed Mar 20, 2024
2 parents ccc3b96 + a0d516c commit d53e900
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions data/sample/initialize_files/sample_satellite.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ initial_torque_b_Nm(2) = 0.000
// SUN_POINTING
// EARTH_CENTER_POINTING
// VELOCITY_DIRECTION_POINTING
// GROUND_SPEED_DIRECTION_POINTING
// ORBIT_NORMAL_POINTING
main_mode = INERTIAL_STABILIZE
sub_mode = SUN_POINTING
Expand Down
5 changes: 5 additions & 0 deletions src/dynamics/attitude/controlled_attitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ libra::Vector<3> ControlledAttitude::CalcTargetDirection_i(AttitudeControlMode m
}
} else if (mode == AttitudeControlMode::kVelocityDirectionPointing) {
direction = orbit_->GetVelocity_i_m_s();
} else if (mode == AttitudeControlMode::kGroundSpeedDirectionPointing) {
libra::Matrix<3, 3> dcm_ecef2eci = local_celestial_information_->GetGlobalInformation().GetEarthRotation().GetDcmJ2000ToEcef().Transpose();
direction = dcm_ecef2eci * orbit_->GetVelocity_ecef_m_s();
} else if (mode == AttitudeControlMode::kOrbitNormalPointing) {
direction = OuterProduct(orbit_->GetPosition_i_m(), orbit_->GetVelocity_i_m_s());
}
Expand Down Expand Up @@ -140,6 +143,8 @@ AttitudeControlMode ConvertStringToCtrlMode(const std::string mode) {
return AttitudeControlMode::kEarthCenterPointing;
} else if (mode == "VELOCITY_DIRECTION_POINTING") {
return AttitudeControlMode::kVelocityDirectionPointing;
} else if (mode == "GROUND_SPEED_DIRECTION_POINTING") {
return AttitudeControlMode::kGroundSpeedDirectionPointing;
} else if (mode == "ORBIT_NORMAL_POINTING") {
return AttitudeControlMode::kOrbitNormalPointing;
} else {
Expand Down
13 changes: 7 additions & 6 deletions src/dynamics/attitude/controlled_attitude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
* @brief Attitude control mode
*/
enum class AttitudeControlMode {
kInertialStabilize, //!< Inertial stabilize
kSunPointing, //!< Sun pointing
kEarthCenterPointing, //!< Earth center pointing
kVelocityDirectionPointing, //!< Spacecraft velocity direction pointing
kOrbitNormalPointing, //!< Orbit normal direction pointing
kNoControl, // No Control
kInertialStabilize, //!< Inertial stabilize
kSunPointing, //!< Sun pointing
kEarthCenterPointing, //!< Earth center pointing
kVelocityDirectionPointing, //!< Spacecraft velocity direction pointing
kGroundSpeedDirectionPointing, //!< Ground speed direction pointing
kOrbitNormalPointing, //!< Orbit normal direction pointing
kNoControl, // No Control
};

/**
Expand Down

0 comments on commit d53e900

Please sign in to comment.