.. _program_listing_file_agents_satellite.cc: Program Listing for File satellite.cc ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``agents/satellite.cc``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "lupnt/agents/satellite.h" #include "lupnt/conversions/state_converter.h" #include "lupnt/core/constants.h" #include "lupnt/core/definitions.h" #include "lupnt/core/logger.h" #include "lupnt/core/simulation.h" #include "lupnt/states/state.h" namespace lupnt { // Satellite Satellite::Satellite(Config& agent_config) : AgentWithDynamics(agent_config) { Logger::Debug(fmt::format("Creating Satellite {}", name_), "Satellite"); // Initial state if (agent_config["initial_state"]) { auto cfg = agent_config["initial_state"]; if (cfg["class"].as() == "ClassicalOE") { Real a = cfg["a"].as(); Real e = cfg["e"].as(); Real i = RAD * cfg["i"].as(); Real Omega = RAD * cfg["Omega"].as(); Real omega = RAD * cfg["omega"].as(); Real M = RAD * cfg["M"].as(); Frame frame = enum_cast(cfg["frame"].as()).value(); State state = ClassicalOE(Vec6(a, e, i, Omega, omega, M), frame); Logger::Debug(fmt::format("Initial state:\n{}", state), "Satellite"); state_ = ConvertFrame(GetLupntEpoch(), ConvertState(state, dynamics_->GetStateType()), Frame::MOON_CI); Logger::Debug(fmt::format("Setting state:\n{}", state_), "Satellite"); } else { LUPNT_CHECK(false, "Unsupported initial state", "Satellite"); } } } void Satellite::Log(Real time) { Agent::Log(time); } void Satellite::LogCesium() { if (!sim_) { Logger::Debug("No simulation found", "Satellite"); return; } auto cesium_viewer = sim_->GetCesiumViewer(); if (!cesium_viewer) { Logger::Debug("No cesium viewer found", "Satellite"); return; } } REGISTER_FACTORY_CLASS(Agent, Satellite) } // namespace lupnt