Class Agent¶
Defined in File agent.h
Inheritance Relationships¶
Base Types¶
public lupnt::Object< Agent >(Template Class Object)public lupnt::DataLogger(Class DataLogger)
Derived Types¶
public lupnt::AgentWithDynamics(Class AgentWithDynamics)public lupnt::EphemerisManager(Class EphemerisManager)public lupnt::GroundStationManager(Class GroundStationManager)public lupnt::LunarNavConstellation(Class LunarNavConstellation)public lupnt::Spacecraft(Class Spacecraft)public lupnt::SurfaceStationManager(Class SurfaceStationManager)
Class Documentation¶
-
class Agent : public lupnt::Object<Agent>, public lupnt::DataLogger¶
Subclassed by lupnt::AgentWithDynamics, lupnt::EphemerisManager, lupnt::GroundStationManager, lupnt::LunarNavConstellation, lupnt::Spacecraft, lupnt::SurfaceStationManager
Public Functions
-
Agent() = default¶
-
Agent(Config &agent_config)¶
Construct an agent from a YAML config node, creating and attaching its devices (and, if specified, application).
Called by
AssetFactory<Agent, Config&>(viaAgentFactory) when the simulation builder instantiates theagents:section of a scenario config; readsname,frequency,devices, andapplicationkeys and creates each listed device/application through its own factory, wiring it back to this agent viaAddDevice/SetApplication.- Parameters:
agent_config – YAML config node for this agent
-
inline Simulation *GetSimulation() const¶
Get the
Simulationthis agent is registered with.- Returns:
Pointer to the owning
Simulation(aborts viaLUPNT_CHECKif the agent has not yet been added to one).
-
inline void SetSimulation(Simulation *sim)¶
Register this agent with a
Simulation, called bySimulation::AddAgentso thatGetSimulation/Setupcan access the event scheduler and Cesium viewer.
-
World *GetWorld() const¶
Get the shared
World(read-only environment) from the owning simulation, or nullptr if the scenario defined noworld:block. Returns the same object asGetSimulation()->GetWorld().
-
inline std::string GetName() const¶
Get the agent’s name (used as a prefix for device names and data-logger keys).
-
inline void SetName(std::string name)¶
Set the agent’s name.
-
inline std::map<std::string, Ptr<Device>> GetDevices() const¶
Get the map of devices (camera, clock, radio, etc.) attached to this agent, keyed by device name.
-
void AddDevice(Ptr<Device> device)¶
Attach a
Deviceto this agent, called during construction (from thedevices:section of the config) or by application setup code that adds devices programmatically. Sets the device’s back-link to this agent and registers it underdevice->GetName().- Parameters:
device – Device to attach; ownership is transferred into
devices_
-
Ptr<Device> GetDevice(const std::string &name) const¶
Look up a previously-attached device by name, trying both the bare name and
<agent_name>/<name>(the convention used byAddDevice/Agent::Agent). Used by application/measurement code to retrieve e.g. aClockorTransmitterdevice from its owning agent. Aborts viaLUPNT_CHECKif no matching device is found.- Parameters:
name – Device name (with or without the
<agent_name>/prefix)- Returns:
The matching device
-
void CreateApplication(Config &config)¶
Create and attach this agent’s
Application(s) from the config. Reads either anapplications:sequence (multiple apps run on this one agent, in list order — e.g. aLanderhosting a guidance/control app then a navigation app) or a singleapplication:map (back-compat). Factored out of theAgent(Config&)constructor so agents that don’t chain to it (e.g.GroundStation) can still opt in. Requiresname_to be set.
-
inline Ptr<Application> GetApplication() const¶
Get the primary
Applicationattached to this agent (the first one, for the single-application API), or nullptr if none. UseGetApplications()for all of them.
-
inline const std::vector<Ptr<Application>> &GetApplications() const¶
All applications attached to this agent, in the order they were added.
-
Ptr<Application> GetApplicationByName(const std::string &name) const¶
Look up an attached application whose (agent-prefixed) name ends with
name, or nullptr if none matches. Lets a multi-application agent’s consumers fetch a specific app (e.g.GetApplicationByName("LanderNavApp")).
-
void SetApplication(Ptr<Application> app)¶
Set the agent’s SOLE application (clears any others), wiring its back-pointer. Back-compat single-application setter.
-
void AddApplication(Ptr<Application> app)¶
Attach an ADDITIONAL application to this agent (appended after any existing ones). The first application added becomes the primary
GetApplication(). Wires the app’s back-pointer so it can reach the owning agent/simulation fromSetup/Step/Log.
-
virtual void Setup()¶
Perform one-time setup before the simulation starts: schedules a periodic
Stepcallback with the simulation event scheduler (iffrequency_ > 0) and callsSetupon each attached device.Called once by
Simulation::Setupfor every registered agent, before the main time-stepping loop begins.AgentWithDynamicsandGnssConstellationoverride/extend this for their own initialization needs.
-
virtual void Step(Real time)¶
Advance the agent by one simulation step at time
time(propagate dynamics, update devices/application, and log state).Invoked periodically by the simulation’s event scheduler at the rate configured via
frequency_(seeSetup). The base implementation is a no-op (logging only);AgentWithDynamics::Stepoverrides it to callPropagateandLog.- Parameters:
time – Current simulation time [s]
-
inline State GetState() const¶
Get the agent’s current state. The base
Agentclass has no intrinsic state representation and always returns an emptyState(); derived classes such asAgentWithDynamicsoverride this to return their Cartesian/orbital state.
-
inline void SetState(const State &state)¶
Set the agent’s current state (base-class no-op storage; see
AgentWithDynamics::SetStatefor the overload that actually drives dynamics propagation).
-
virtual Cart6 GetStateAt(Real t) const = 0¶
Compute (or interpolate/propagate) the agent’s Cartesian state
[r; v]at an arbitrary timet, without mutating the agent’s stored state/time.Pure virtual: every concrete agent (Satellite, Rover, GroundStation, SurfaceStation, …) must provide this so that measurement models and other agents can query “where was/will this agent be at time `t`” (e.g. for light-time-corrected GNSS pseudorange computation).
- Parameters:
t – Query time [s]
- Returns:
Cartesian state
[r; v]at timet, in the agent’s dynamics frame
-
virtual void Log(Real time)¶
Write this agent’s state/devices/application to the
DataLogger. Called once perStep(after propagation) byAgentWithDynamics::Step; the base implementation is a no-op.- Parameters:
time – Current simulation time [s]
-
virtual void LogCesium()¶
Push this agent’s current state/geometry to the Cesium 3D viewer (if one is attached to the simulation). Called once per
StepalongsideLog; the base implementation is a no-op.
-
Agent() = default¶