Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InertialComponent ¶ added in v0.8.0
type InertialComponent interface {
GetMass() float64
GetPosition() types.Vector3 // Position of the component's reference point in rocket global axes
GetCenterOfMassLocal() types.Vector3 // Position of the component's CM relative to its reference point, in component local axes
GetInertiaTensorLocal() types.Matrix3x3 // Inertia tensor of component about its own CM, in component local axes
}
InertialComponent defines an interface for components that contribute to mass and inertia.
type PhysicsStateConfig ¶ added in v0.8.0
type PhysicsStateConfig struct {
OverallRocketCG types.Vector3
TotalInertiaTensorBody types.Matrix3x3
InverseTotalInertiaTensorBody types.Matrix3x3
InitialMass float64
Motor *components.Motor
Bodytube *components.Bodytube
Nosecone *components.Nosecone
Finset *components.TrapezoidFinset
Parachute *components.Parachute
}
PhysicsStateConfig holds parameters for creating a PhysicsState.
type RocketEntity ¶
type RocketEntity struct {
*ecs.BasicEntity
*states.PhysicsState
*types.Mass // This will store the initial total mass for reference
// contains filtered or unexported fields
}
RocketEntity represents a complete rocket with all its components
func NewRocketEntity ¶
func NewRocketEntity(world *ecs.World, orkData *openrocket.OpenrocketDocument, motor *components.Motor, log *logf.Logger) *RocketEntity
NewRocketEntity creates a new rocket entity from OpenRocket data and a motor. It initializes physical properties, components, CG, and inertia.
func (*RocketEntity) GetComponent ¶
func (r *RocketEntity) GetComponent(name string) interface{}
AddComponent adds a component to the entity
func (*RocketEntity) GetCurrentMassKg ¶ added in v0.8.0
func (r *RocketEntity) GetCurrentMassKg() float64
GetCurrentMassKg calculates the current total mass of the rocket by summing the masses of its components. It pays special attention to components that implement InertialComponent (like the motor) to get their current mass.