Skip to content

Commit

Permalink
Merge pull request #90 from ut-issl/feature/add_torque_generator
Browse files Browse the repository at this point in the history
Add torque generator
  • Loading branch information
TomokiMochizuki authored Jan 22, 2024
2 parents 6fcfc5a + c1de90a commit 88d9ffb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions s2e-ff/data/initialize_files/components/torque_generator.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[TORQUE_GENERATOR]
// Standard deviation of torque magnitude error [Nm]
torque_magnitude_standard_deviation_Nm = 0.001

// Standard deviation of torque direction error [deg]
torque_direction_standard_deviation_deg = 1

[COMPONENT_BASE]
// Prescaler with respect to the component update period
prescaler = 1
1 change: 1 addition & 0 deletions s2e-ff/data/initialize_files/ff_satellite.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@ relative_velocity_sensor_file = ../../data/initialize_files/components/relative_
laser_distance_meter_file = ../../data/initialize_files/components/laser_distance_meter.ini
qpd_positioning_sensor_file = ../../data/initialize_files/components/qpd_positioning_sensor.ini
force_generator_file = ../../data/initialize_files/components/force_generator.ini
torque_generator_file = ../../data/initialize_files/components/torque_generator.ini
relative_attitude_controller_file = ../../data/initialize_files/components/relative_attitude_controller.ini
13 changes: 12 additions & 1 deletion s2e-ff/src/simulation/spacecraft/ff_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ FfComponents::FfComponents(const Dynamics* dynamics, const Structure* structure,
const std::string force_generator_file = sat_file.ReadString(section_name.c_str(), "force_generator_file");
force_generator_ = new ForceGenerator(InitializeForceGenerator(clock_gen, force_generator_file, dynamics_));

const std::string torque_generator_file = sat_file.ReadString(section_name.c_str(), "torque_generator_file");
torque_generator_ = new TorqueGenerator(InitializeTorqueGenerator(clock_gen, torque_generator_file, dynamics_));

const std::string relative_attitude_controller_file = sat_file.ReadString(section_name.c_str(), "relative_attitude_controller_file");
relative_attitude_controller_ = new RelativeAttitudeController(InitializeRelativeAttitudeController(
clock_gen, relative_attitude_controller_file, *rel_info_, local_env_->GetCelestialInformation(), *dynamics_, sat_id));
Expand All @@ -58,6 +61,12 @@ FfComponents::FfComponents(const Dynamics* dynamics, const Structure* structure,
force_N[1] = 0.0;
force_N[2] = 0.0;
// force_generator_->SetForce_b_N(force_N);

libra::Vector<3> torque_Nm;
torque_Nm[0] = 0.1;
torque_Nm[1] = 0.0;
torque_Nm[2] = 0.0;
// torque_generator_->SetTorque_b_Nm(torque_Nm);
}

FfComponents::~FfComponents() {
Expand All @@ -66,6 +75,7 @@ FfComponents::~FfComponents() {
delete relative_attitude_sensor_;
delete relative_velocity_sensor_;
delete force_generator_;
delete torque_generator_;
delete relative_attitude_controller_;
delete laser_distance_meter_;
delete qpd_positioning_sensor_;
Expand All @@ -80,8 +90,8 @@ Vector<3> FfComponents::GenerateForce_b_N() {
}

Vector<3> FfComponents::GenerateTorque_b_Nm() {
// No attitude control component
Vector<3> torque_b_Nm_(0.0);
torque_b_Nm_ += torque_generator_->GetGeneratedTorque_b_Nm();
return torque_b_Nm_;
}

Expand All @@ -91,6 +101,7 @@ void FfComponents::LogSetup(Logger& logger) {
logger.AddLogList(relative_attitude_sensor_);
logger.AddLogList(relative_velocity_sensor_);
logger.AddLogList(force_generator_);
logger.AddLogList(torque_generator_);
logger.AddLogList(laser_distance_meter_);
logger.AddLogList(qpd_positioning_sensor_);
}
2 changes: 2 additions & 0 deletions s2e-ff/src/simulation/spacecraft/ff_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// include for components
#include <components/ideal/force_generator.hpp>
#include <components/ideal/torque_generator.hpp>
#include <components/real/cdh/on_board_computer.hpp>

#include "../../components/aocs/initialize_relative_distance_sensor.hpp"
Expand Down Expand Up @@ -73,6 +74,7 @@ class FfComponents : public InstalledComponents {
QpdPositioningSensor* qpd_positioning_sensor_;
// Actuators
ForceGenerator* force_generator_; //!< Example of force generator
TorqueGenerator* torque_generator_; //!< Example of torque generator
RelativeAttitudeController* relative_attitude_controller_; //!< Example of attitude controller

// References
Expand Down

0 comments on commit 88d9ffb

Please sign in to comment.