Class AgentWithDynamics¶
Defined in File agent.h
Inheritance Relationships¶
Base Type¶
public lupnt::Agent(Class Agent)
Derived Types¶
public lupnt::GroundStation(Class GroundStation)public lupnt::Rover(Class Rover)public lupnt::Satellite(Class Satellite)public lupnt::SurfaceStation(Class SurfaceStation)
Class Documentation¶
-
class AgentWithDynamics : public lupnt::Agent¶
Subclassed by lupnt::GroundStation, lupnt::Rover, lupnt::Satellite, lupnt::SurfaceStation
Public Functions
-
AgentWithDynamics() = default¶
-
AgentWithDynamics(Config &agent_config)¶
Construct an agent with orbital and attitude dynamics from a YAML config node.
Extends
Agent::Agent: in addition to devices/application, creates thedynamics:andattitude_dynamics:blocks via their respectiveAssetFactory(defaulting attitude dynamics toFixedAttitudeDynamicsif not specified), initializesstate_/attitude_to zero in theMOON_CIframe, and reads the optionalprecomputeinterval. Used as the base constructor forSatellite,Rover,GroundStation, andSurfaceStation.- Parameters:
agent_config – YAML config node for this agent
-
virtual void Setup() override¶
Base-class setup (schedule periodic
Step, set up devices);AgentWithDynamicscurrently adds no further initialization beyondAgent::Setup.
-
virtual void Step(Real time) override¶
Advance this agent by one simulation step: propagate orbital/attitude dynamics to
timeviaPropagate, then log the resulting state viaLog.- Parameters:
time – Target simulation time [s]
-
inline void SetTime(Real t)¶
Set the agent’s current simulation time [s] (without propagating; use
Propagateto advance the state consistently).
-
inline void SetFrequency(Real frequency)¶
Set the agent’s
Stepscheduling frequency [Hz], used bySetupto register the periodic simulation callback.
-
inline State GetState() const¶
Get the agent’s current Cartesian state
[r; v](in the frame returned bydynamics_->GetFrame(), typicallyMOON_CI).
-
inline void SetState(const State &x)¶
Set the agent’s current Cartesian state
[r; v], e.g. to initialize a scenario or apply a filter/estimator correction.
-
inline void SetAttitude(const Attitude &attitude)¶
Set the agent’s current attitude (quaternion + angular rate).
-
inline State GetControl() const¶
Get the agent’s current control input (e.g. rover linear/angular velocity commands), passed to
dynamics_->Propagate.
-
inline void SetControl(const State &control)¶
Set the agent’s current control input, applied on the next call to
Propagate/Step.
-
inline Dynamics *GetDynamics() const¶
Get the orbital/translational
Dynamicsmodel drivingPropagate.- Returns:
Raw pointer to the dynamics model (aborts via
LUPNT_CHECKif none has been set).
-
inline void SetDynamics(Ptr<Dynamics> dyn)¶
Set the orbital/translational dynamics model, called during construction (from the
dynamics:config block) or to swap dynamics models at runtime.
-
inline AttitudeDynamics *GetAttitudeDynamics() const¶
Get the
AttitudeDynamicsmodel driving attitude propagation inPropagate/GetAttitudeAt.- Returns:
Raw pointer to the attitude dynamics model (aborts via
LUPNT_CHECKif none has been set).
-
inline void SetAttitudeDynamics(Ptr<AttitudeDynamics> dyn)¶
Set the attitude dynamics model, called during construction (from the
attitude_dynamics:config block, defaulting toFixedAttitudeDynamics) or to swap models at runtime.
-
inline void SetBodyId(BodyId body_id)¶
Set the ID of the central body this agent’s dynamics are referenced to (e.g.
BodyId::EARTH,BodyId::MOON).
-
inline BodyId GetBodyId() const¶
Get the ID of the central body this agent’s dynamics are referenced to.
-
virtual void Propagate(Real t)¶
Advance the agent’s stored orbital state, attitude, and time from
time_totby integratingdynamics_/attitude_dynamics_.Called once per
StepbyAgentWithDynamics::Step(and overridden byRover::Propagatefor its 2D surface-dynamics model). Mutatesstate_,attitude_, andtime_in place using the currentcontrol_.- Parameters:
t – Target simulation time [s]
-
virtual Cart6 GetStateAt(Real t) const override¶
Compute the agent’s Cartesian state
[r; v]at timetwithout mutating the stored state.If
tmatches the agent’s currenttime_(withinEPS), returns the cachedstate_directly; otherwise propagates a copy ofstate_fromtime_totviadynamics_->Propagate. Used by measurement models and other agents to query this agent’s position/velocity at an arbitrary (e.g. light-time-corrected) epoch.- Parameters:
t – Query time [s]
- Returns:
Cartesian state
[r; v]at timet
-
virtual Attitude GetAttitudeAt(Real t) const¶
Compute the agent’s attitude at time
twithout mutating the stored attitude.If
tmatchestime_(withinEPS), or no attitude dynamics are set, returns the cachedattitude_directly; otherwise propagates a copy ofattitude_fromtime_totviaattitude_dynamics_->Propagate.- Parameters:
t – Query time [s]
- Returns:
Attitude (quaternion + angular rate) at time
t
-
virtual void Log(Real time) override¶
Log this agent’s state, attitude, and control vectors (and the attached application’s state, if any) to the
DataLogger. Called once perStepbyAgentWithDynamics::Step.- Parameters:
time – Current simulation time [s]
-
virtual void LogCesium() override¶
Push this agent’s geometry to the Cesium 3D viewer. Currently a no-op for the base
AgentWithDynamics;Satellite/SurfaceStationoverride it (see their respective headers).
-
AgentWithDynamics() = default¶