|
Icarus
Vehicle Simulation as a Transformable Computational Graph, built on Vulcan and Janus
|
Intermediate class for components with physical body attachment. More...
#include <PhysicalComponent.hpp>


Public Member Functions | |
| bool | HasBodyAttachment () const override |
| Whether this component has a body attachment (position/orientation). | |
| Vec3< Scalar > | GetBodyPosition () const override |
| Get the component's mounting position in vehicle body frame. | |
| janus::Quaternion< Scalar > | GetBodyOrientation () const override |
| Get the component's mounting orientation (body-to-component rotation). | |
| janus::Quaternion< Scalar > | GetComponentToBodyRotation () const |
| Get rotation from component frame to body frame. | |
| Vec3< Scalar > | TransformToBodyFrame (const Vec3< Scalar > &v_local) const |
| Transform a vector from component local frame to body frame. | |
| Vec3< Scalar > | TransformToLocalFrame (const Vec3< Scalar > &v_body) const |
| Transform a vector from body frame to component local frame. | |
| Public Member Functions inherited from icarus::Component< Scalar > | |
| virtual | ~Component ()=default |
| virtual void | Provision (Backplane< Scalar > &bp)=0 |
| Provision phase - called once at application launch. | |
| virtual void | Stage (Backplane< Scalar > &bp)=0 |
| Stage phase - called at start of each run/episode. | |
| virtual void | Step (Scalar t, Scalar dt)=0 |
| Step phase - called every time step (hot path!). | |
| virtual void | PreStep (Scalar, Scalar) |
| Called before any component Steps (for pre-processing). | |
| virtual void | PostStep (Scalar, Scalar) |
| Called after all component Steps (for post-processing). | |
| virtual void | OnError (const SimulationError &) |
| Called when simulation encounters an error. | |
| virtual void | Shutdown () |
| Called during shutdown (cleanup, flush buffers). | |
| virtual std::string | Name () const =0 |
| Component instance name (e.g., "MainEngine"). | |
| virtual std::string | Entity () const |
| Entity namespace (e.g., "X15"). | |
| virtual std::string | TypeName () const |
| Component type name for data dictionary (e.g., "JetEngine"). | |
| std::string | FullName () const |
| Full qualified name: entity.component (or just component). | |
| virtual std::vector< SignalDecl > | DeclareInputs () const |
| Declared inputs (for documentation/dependency graph). | |
| virtual std::vector< SignalDecl > | DeclareOutputs () const |
| Declared outputs (for documentation/dependency graph). | |
| std::vector< std::string > | GetOutputNames () const |
| Get list of output signal names. | |
| std::vector< std::string > | GetInputNames () const |
| Get list of input signal names. | |
| bool | IsProvisioned () const |
| Check if Provision has been called. | |
| bool | IsStaged () const |
| Check if Stage has been called. | |
| void | SetConfig (ComponentConfig config) |
| Set component configuration (called by factory after construction). | |
| const ComponentConfig & | GetConfig () const |
| Get component configuration. | |
| const vulcan::time::Epoch< Scalar > * | GetEpoch () const |
| Get simulation epoch (read-only). | |
Protected Member Functions | |
| void | ReadAttachmentFromConfig () |
| Read body attachment from component config. | |
| void | SetBodyAttachment (const Vec3< Scalar > &position, const janus::Quaternion< Scalar > &orientation) |
| Set body attachment programmatically (for testing or dynamic mounting). | |
| void | SetBodyPosition (const Vec3< Scalar > &position) |
| Set body position only (orientation defaults to identity). | |
| Protected Member Functions inherited from icarus::Component< Scalar > | |
| template<typename T> | |
| T | read_param (const std::string &key, const T &default_val) const |
| Read a scalar config parameter with default. | |
| template<typename T> | |
| T | require_param (const std::string &key) const |
| Read a required scalar config parameter (throws if missing). | |
| Vec3< Scalar > | read_param_vec3 (const std::string &key, const Vec3< Scalar > &default_val) const |
| Read a Vec3 config parameter with automatic double→Scalar conversion. | |
| Vec3< Scalar > | require_param_vec3 (const std::string &key) const |
| Read a required Vec3 config parameter (throws if missing). | |
| Vec4< Scalar > | read_param_vec4 (const std::string &key, const Vec4< Scalar > &default_val) const |
| Read a Vec4 config parameter with automatic double→Scalar conversion. | |
| Vec4< Scalar > | require_param_vec4 (const std::string &key) const |
| Read a required Vec4 config parameter (throws if missing). | |
| void | MarkProvisioned () |
| void | MarkStaged () |
| void | ResetStaged () |
| void | BindEpoch (const vulcan::time::Epoch< Scalar > *epoch) |
Protected Attributes | |
| Vec3< Scalar > | body_position_ = Vec3<Scalar>::Zero() |
| Mounting position in vehicle body frame [m]. | |
| janus::Quaternion< Scalar > | body_orientation_ |
| Rotation from body frame to component local frame (identity by default). | |
| bool | has_body_attachment_ = false |
| True after ReadAttachmentFromConfig() is called. | |
Intermediate class for components with physical body attachment.
Components that have a physical presence on the vehicle (mass sources, force sources, sensors, actuators) should inherit from this class.
Provides:
Non-physical components (environment models, schedulers, etc.) should inherit directly from Component<Scalar>.
Subclasses call ReadAttachmentFromConfig() in Stage() to parse:
body_orientation represents the rotation FROM body frame TO component local frame (body-to-component).
CAD Interpretation: The Euler angles describe "how I rotated this component starting from alignment with body axes."
Frame Transformation:
A rocket engine with thrust along its local +X axis, mounted at body position [0, 0, 10] pointing along body -Z:
The engine outputs force_local = [thrust, 0, 0]. Vehicle6DOF transforms: F_body = R.conjugate().rotate([thrust, 0, 0]) = [0, 0, -thrust]
| Scalar | Numeric type (double or casadi::MX) |
|
inlinenodiscardoverridevirtual |
Get the component's mounting orientation (body-to-component rotation).
Convention: Transforms vectors FROM body frame TO component local frame. To transform component outputs TO body frame, use conjugate().
Reimplemented from icarus::Component< Scalar >.
|
inlinenodiscardoverridevirtual |
Get the component's mounting position in vehicle body frame.
Reimplemented from icarus::Component< Scalar >.
|
inlinenodiscard |
Get rotation from component frame to body frame.
This is the inverse of GetBodyOrientation() and is commonly needed to transform component outputs (forces, moments) to body frame.
|
inlinenodiscardoverridevirtual |
Whether this component has a body attachment (position/orientation).
Reimplemented from icarus::Component< Scalar >.
|
inlineprotected |
Read body attachment from component config.
Call this in Stage() to parse body_position and body_orientation from the component's YAML configuration.
Supports two orientation formats:
If neither orientation is specified, defaults to identity (no rotation). If body_position is not specified, defaults to origin [0, 0, 0].
Convention Note: The YAML config uses body_orientation_euler_zyx: [yaw, pitch, roll] (degrees, aerospace order), but Janus from_euler() expects (roll, pitch, yaw) (radians). This method handles the conversion.
|
inlineprotected |
Set body attachment programmatically (for testing or dynamic mounting).
| position | Position in vehicle body frame [m] |
| orientation | Rotation from body to component frame |
|
inlineprotected |
Set body position only (orientation defaults to identity).
| position | Position in vehicle body frame [m] |
|
inlinenodiscard |
Transform a vector from component local frame to body frame.
| v_local | Vector in component local frame |
|
inlinenodiscard |
Transform a vector from body frame to component local frame.
| v_body | Vector in body frame |
|
protected |
Rotation from body frame to component local frame (identity by default).
|
protected |
Mounting position in vehicle body frame [m].
|
protected |
True after ReadAttachmentFromConfig() is called.