Class Agent¶
Defined in File agent.h
Inheritance Relationships¶
Base Types¶
public lupnt::Object< Agent >(Template Class Object)public lupnt::DataLogger(Class DataLogger)
Derived Type¶
public lupnt::AgentWithDynamics(Class AgentWithDynamics)
Class Documentation¶
-
class Agent : public lupnt::Object<Agent>, public lupnt::DataLogger¶
Subclassed by lupnt::AgentWithDynamics
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.
-
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
-
inline Ptr<Application> GetApplication() const¶
Get the
Applicationattached to this agent (e.g. an LNSS, rover, or surface-station application), if any.
-
inline void SetApplication(Ptr<Application> app)¶
Attach an
Applicationto this agent, called during construction (from theapplication:section of the config).
-
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¶