openrocket

package
v0.0.0-...-57fb5ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AngleOffset

type AngleOffset struct {
	XMLName xml.Name `xml:"angleoffset"`
	Method  string   `xml:"method,attr"`
	Value   float64  `xml:",chardata"`
}

AngleOffset represents the angle offset element of the XML document

func (*AngleOffset) String

func (a *AngleOffset) String() string

String returns full string representation of the angleoffset

type AxialOffset

type AxialOffset struct {
	XMLName xml.Name `xml:"axialoffset"`
	Method  string   `xml:"method,attr"`
	Value   float64  `xml:",chardata"`
}

AxialOffset is a calculated offset from the center of the component to the center of the rocket

func (*AxialOffset) String

func (a *AxialOffset) String() string

String returns full string representation of the AxialOffset

type BodyTube

type BodyTube struct {
	XMLName       xml.Name              `xml:"bodytube"`
	Name          string                `xml:"name"`
	ID            string                `xml:"id"`
	Finish        string                `xml:"finish"`
	Material      Material              `xml:"material"`
	Length        float64               `xml:"length"`
	Thickness     float64               `xml:"thickness"`
	Radius        string                `xml:"radius"` // WARN: May be 'auto' and num
	Subcomponents BodyTubeSubcomponents `xml:"subcomponents"`
}

BodyTube represents the body tube element of the XML document

func (*BodyTube) GetMass

func (b *BodyTube) GetMass() float64

GetMass returns the mass of the bodytube

func (*BodyTube) String

func (b *BodyTube) String() string

String returns full string representation of the BodyTube

type BodyTubeSubcomponents

type BodyTubeSubcomponents struct {
	XMLName         xml.Name        `xml:"subcomponents"`
	InnerTube       InnerTube       `xml:"innertube"`
	TrapezoidFinset TrapezoidFinset `xml:"trapezoidfinset"`
	Parachute       Parachute       `xml:"parachute"`
	CenteringRings  []CenteringRing `xml:"centeringring"`
	Shockcord       Shockcord       `xml:"shockcord"`
}

BodyTubeSubcomponents represents the nested subcomponents element of the XML document

func (*BodyTubeSubcomponents) String

func (b *BodyTubeSubcomponents) String() string

String returns full string representation of the BodyTubeSubcomponents

type CenteringRing

type CenteringRing struct {
	XMLName            xml.Name    `xml:"centeringring"`
	Name               string      `xml:"name"`
	ID                 string      `xml:"id"`
	InstanceCount      int         `xml:"instancecount"`
	InstanceSeparation float64     `xml:"instanceseparation"`
	AxialOffset        AxialOffset `xml:"axialoffset"`
	Position           Position    `xml:"position"`
	Material           Material    `xml:"material"`
	Length             float64     `xml:"length"`
	RadialPosition     float64     `xml:"radialposition"`
	RadialDirection    float64     `xml:"radialdirection"`
	OuterRadius        string      `xml:"outerradius"` // WARN: May be 'auto'
	InnerRadius        string      `xml:"innerradius"` // WARN: May be 'auto'
}

CenteringRing represents the centering ring element of the XML document

func (*CenteringRing) String

func (c *CenteringRing) String() string

String returns full string representation of the CenteringRing

type DeploymentConfig

type DeploymentConfig struct {
	XMLName        xml.Name `xml:"deploymentconfiguration"`
	ConfigID       string   `xml:"configid,attr"`
	DeployEvent    string   `xml:"deployevent"`
	DeployAltitude float64  `xml:"deployaltitude"`
	DeployDelay    float64  `xml:"deploydelay"`
}

DeploymentConfig represents the deployment configuration element of the XML document

func (*DeploymentConfig) String

func (d *DeploymentConfig) String() string

String returns full string representation of the deployment clusterconfiguration

type FilletMaterial

type FilletMaterial struct {
	XMLName xml.Name `xml:"filletmaterial"`
	Type    string   `xml:"type,attr"`
	Density float64  `xml:"density,attr"`
	Name    string   `xml:",chardata"`
}

FilletMaterial represents the fillet material element of the XML document (XMLName is the only delta from Material)

func (*FilletMaterial) String

func (f *FilletMaterial) String() string

String returns full string representation of the filletmaterial

type IgnitionConfig

type IgnitionConfig struct {
	XMLName       xml.Name `xml:"ignitionconfiguration"`
	ConfigID      string   `xml:"configid,attr"`
	IgnitionEvent string   `xml:"ignitionevent"`
	IgnitionDelay float64  `xml:"ignitiondelay"`
}

IgnitionConfig represents the ignition configuration element of the XML document

func (*IgnitionConfig) String

func (i *IgnitionConfig) String() string

String returns full string representation of the ignition clusterconfiguration

type InnerTube

type InnerTube struct {
	XMLName              xml.Name          `xml:"innertube"`
	Name                 string            `xml:"name"`
	ID                   string            `xml:"id"`
	AxialOffset          AxialOffset       `xml:"axialoffset"`
	Position             Position          `xml:"position"`
	Material             Material          `xml:"material"`
	Length               float64           `xml:"length"`
	RadialPosition       float64           `xml:"radialposition"`
	RadialDirection      float64           `xml:"radialdirection"`
	OuterRadius          float64           `xml:"outerradius"`
	Thickness            float64           `xml:"thickness"`
	ClusterConfiguration string            `xml:"clusterconfiguration"`
	ClusterScale         float64           `xml:"clusterscale"`
	ClusterRotation      float64           `xml:"clusterrotation"`
	MotorMount           MotorMount        `xml:"motormount"`
	Subcomponents        NoseSubcomponents `xml:"subcomponents"` // TODO: Refactor naming here
}

InnerTube represents the inner tube element of the XML document

func (*InnerTube) String

func (i *InnerTube) String() string

String returns full string representation of the innertube

type LineMaterial

type LineMaterial struct {
	XMLName xml.Name `xml:"linematerial"`
	Type    string   `xml:"type,attr"`
	Density float64  `xml:"density,attr"`
	Name    string   `xml:",chardata"`
}

LineMaterial is the same as Material with a diff XMLName

func (*LineMaterial) String

func (l *LineMaterial) String() string

String returns full string representation of the LineMaterial

type MassComponent

type MassComponent struct {
	XMLName         xml.Name    `xml:"masscomponent"`
	Name            string      `xml:"name"`
	ID              string      `xml:"id"`
	AxialOffset     AxialOffset `xml:"axialoffset"`
	Position        Position    `xml:"position"`
	PackedLength    float64     `xml:"packedlength"`
	PackedRadius    float64     `xml:"packedradius"`
	RadialPosition  float64     `xml:"radialposition"`
	RadialDirection float64     `xml:"radialdirection"`
	Mass            float64     `xml:"mass"`
	Type            string      `xml:"masscomponenttype"`
}

MassComponent represents the mass component element of the XML document

func (*MassComponent) String

func (m *MassComponent) String() string

String returns full string representation of the MassComponent

type Material

type Material struct {
	XMLName xml.Name `xml:"material"`
	Type    string   `xml:"type,attr"`
	Density float64  `xml:"density,attr"`
	Name    string   `xml:",chardata"`
}

Material represents the material element of the XML document

func (*Material) String

func (m *Material) String() string

String returns full string representation of the Material

type Motor

type Motor struct {
	XMLName      xml.Name `xml:"motor"`
	ConfigID     string   `xml:"configid,attr"`
	Type         string   `xml:"type"`
	Manufacturer string   `xml:"manufacturer"`
	Digest       string   `xml:"digest"`
	Designation  string   `xml:"designation"`
	Diameter     float64  `xml:"diameter"`
	Length       float64  `xml:"length"`
	Delay        string   `xml:"delay"`
}

Motor represents the motor element of the XML document

func (*Motor) String

func (m *Motor) String() string

String returns full string representation of the motormount

type MotorConfiguration

type MotorConfiguration struct {
	XMLName  xml.Name `xml:"motorconfiguration"`
	ConfigID string   `xml:"configid,attr"`
	Default  bool     `xml:"default,attr"`
	Stages   []Stage  `xml:"stage"`
}

MotorConfiguration represents the motor configuration element of the XML document

func (*MotorConfiguration) String

func (m *MotorConfiguration) String() string

String returns full string representation of the MotorConfiguration

type MotorMount

type MotorMount struct {
	XMLName        xml.Name       `xml:"motormount"`
	IgnitionEvent  string         `xml:"ignitionevent"`
	IgnitionDelay  float64        `xml:"ignitiondelay"`
	Overhang       float64        `xml:"overhang"`
	Motor          Motor          `xml:"motor"`
	IgnitionConfig IgnitionConfig `xml:"ignitionconfiguration"` // WARN: This duplicates field above but let's keep it for now
}

MotorMount represents the motor mount element of the XML document

func (*MotorMount) String

func (m *MotorMount) String() string

String returns full string representation of the motormount

type NoseSubcomponents

type NoseSubcomponents struct {
	XMLName       xml.Name      `xml:"subcomponents"`
	CenteringRing CenteringRing `xml:"centeringring"`
	MassComponent MassComponent `xml:"masscomponent"`
}

NoseSubcomponents represents the nested subcomponents element of the XML document

func (*NoseSubcomponents) String

func (n *NoseSubcomponents) String() string

String returns full string representation of the NoseSubcomponents

type Nosecone

type Nosecone struct {
	XMLName              xml.Name          `xml:"nosecone"`
	Name                 string            `xml:"name"`
	ID                   string            `xml:"id"`
	Finish               string            `xml:"finish"`
	Material             Material          `xml:"material"`
	Length               float64           `xml:"length"`
	Thickness            float64           `xml:"thickness"`
	Shape                string            `xml:"shape"`
	ShapeClipped         bool              `xml:"shapeclipped"`
	ShapeParameter       float64           `xml:"shapeparameter"`
	AftRadius            float64           `xml:"aftradius"`
	AftShoulderRadius    float64           `xml:"aftshoulderradius"`
	AftShoulderLength    float64           `xml:"aftshoulderlength"`
	AftShoulderThickness float64           `xml:"aftshoulderthickness"`
	AftShoulderCapped    bool              `xml:"aftshouldercapped"`
	IsFlipped            bool              `xml:"isflipped"`
	Subcomponents        NoseSubcomponents `xml:"subcomponents"`
}

Nosecone represents the nosecone element of the XML document

func (*Nosecone) GetMass

func (n *Nosecone) GetMass() float64

GetMass returns the mass of the nose cone

func (*Nosecone) String

func (n *Nosecone) String() string

String returns full string representation of the Nosecone

type OpenrocketDocument

type OpenrocketDocument struct {
	XMLName xml.Name       `xml:"openrocket"`
	Version string         `xml:"version,attr"`
	Creator string         `xml:"creator,attr"`
	Rocket  RocketDocument `xml:"rocket"`
}

OpenrocketDocument represents the root of the XML document

func Load

func Load(filename string, version string) (*OpenrocketDocument, error)

func (*OpenrocketDocument) Describe

func (o *OpenrocketDocument) Describe() string

Describe returns a string representation of the OpenrocketDocument

func (*OpenrocketDocument) String

func (o *OpenrocketDocument) String() string

String returns full string representation of the OpenrocketDocument

func (*OpenrocketDocument) Validate

func (o *OpenrocketDocument) Validate(cfg *config.Config) error

Validate checks if the OpenrocketDocument is valid for this program

type Parachute

type Parachute struct {
	XMLName          xml.Name         `xml:"parachute"`
	Name             string           `xml:"name"`
	ID               string           `xml:"id"`
	AxialOffset      AxialOffset      `xml:"axialoffset"`
	Position         Position         `xml:"position"`
	PackedLength     float64          `xml:"packedlength"`
	PackedRadius     float64          `xml:"packedradius"`
	RadialPosition   float64          `xml:"radialposition"`
	RadialDirection  float64          `xml:"radialdirection"`
	CD               string           `xml:"cd"` // WARN: May be 'auto' and num
	Material         Material         `xml:"material"`
	DeployEvent      string           `xml:"deployevent"`
	DeployAltitude   float64          `xml:"deployaltitude"`
	DeployDelay      float64          `xml:"deploydelay"`
	DeploymentConfig DeploymentConfig `xml:"deploymentconfiguration"`
	Diameter         float64          `xml:"diameter"`
	LineCount        int              `xml:"linecount"`
	LineLength       float64          `xml:"linelength"`
	LineMaterial     LineMaterial     `xml:"linematerial"`
}

Parachute represents the parachute element of the XML document

func (*Parachute) String

func (p *Parachute) String() string

String returns full string representation of the parachute

type Position

type Position struct {
	XMLName xml.Name `xml:"position"`
	Value   float64  `xml:",chardata"`
	Type    string   `xml:"type,attr"`
}

Position represents the position of the component in the rocket

func (*Position) String

func (p *Position) String() string

String returns full string representation of the Position

type RadiusOffset

type RadiusOffset struct {
	XMLName xml.Name `xml:"radiusoffset"`
	Method  string   `xml:"method,attr"`
	Value   float64  `xml:",chardata"`
}

RadiusOffset represents the radius offset element of the XML document

func (*RadiusOffset) String

func (r *RadiusOffset) String() string

String returns full string representation of the radiusoffset

type RocketDocument

type RocketDocument struct {
	XMLName            xml.Name           `xml:"rocket"`
	Name               string             `xml:"name"`
	ID                 string             `xml:"id"`
	AxialOffset        AxialOffset        `xml:"axialoffset"`
	Position           Position           `xml:"position"`
	Designer           string             `xml:"designer"`
	Revision           string             `xml:"revision"`
	MotorConfiguration MotorConfiguration `xml:"motorconfiguration"`
	ReferenceType      string             `xml:"referencetype"`
	Subcomponents      Subcomponents      `xml:"subcomponents"`
}

RocketDocument represents the rocket element of the XML document

func (*RocketDocument) String

func (r *RocketDocument) String() string

String returns full string representation of the RocketDocument

type RocketStage

type RocketStage struct {
	XMLName                xml.Name               `xml:"stage"`
	Name                   string                 `xml:"name"`
	ID                     string                 `xml:"id"`
	SustainerSubcomponents SustainerSubcomponents `xml:"subcomponents"`
}

RocketStage represents the stage subcomponent element of the XML document

func (*RocketStage) String

func (r *RocketStage) String() string

String returns full string representation of the RocketStage

type Shockcord

type Shockcord struct {
	XMLName         xml.Name    `xml:"shockcord"`
	Name            string      `xml:"name"`
	ID              string      `xml:"id"`
	AxialOffset     AxialOffset `xml:"axialoffset"`
	Position        Position    `xml:"position"`
	PackedLength    float64     `xml:"packedlength"`
	PackedRadius    float64     `xml:"packedradius"`
	RadialPosition  float64     `xml:"radialposition"`
	RadialDirection float64     `xml:"radialdirection"`
	CordLength      float64     `xml:"cordlength"`
	Material        Material    `xml:"material"`
}

Shockcord represents the shockcord element of the XML document

func (*Shockcord) String

func (s *Shockcord) String() string

String returns full string representation of the shockcord

type Stage

type Stage struct {
	XMLName xml.Name `xml:"stage"`
	Number  int      `xml:"number,attr"`
	Active  bool     `xml:"active,attr"`
}

Stage represents motor configuration stages

func (*Stage) String

func (s *Stage) String() string

String returns full string representation of the Stage

type Subcomponents

type Subcomponents struct {
	XMLName xml.Name      `xml:"subcomponents"`
	Stages  []RocketStage `xml:"stage"`
}

Subcomponents represents the subcomponents element of the XML document

func (*Subcomponents) List

func (s *Subcomponents) List() []RocketStage

List returns a list of all subcomponents so we can iterate over them

func (*Subcomponents) String

func (s *Subcomponents) String() string

String returns full string representation of the Subcomponents

type SustainerSubcomponents

type SustainerSubcomponents struct {
	XMLName  xml.Name `xml:"subcomponents"`
	Nosecone Nosecone `xml:"nosecone"`
	BodyTube BodyTube `xml:"bodytube"`
}

SustainerSubcomponents represents the sustainer subcomponents element of the XML document

func (*SustainerSubcomponents) String

func (s *SustainerSubcomponents) String() string

String returns full string representation of the SustainerSubcomponents

type TabPosition

type TabPosition struct {
	RelativeTo string  `xml:"relativeto,attr"`
	Value      float64 `xml:",chardata"`
}

TabPosition represents the tabposition element of the XML document

func (*TabPosition) String

func (t *TabPosition) String() string

String returns full string representation of the tabposition

type TrapezoidFinset

type TrapezoidFinset struct {
	XMLName        xml.Name       `xml:"trapezoidfinset"`
	Name           string         `xml:"name"`
	ID             string         `xml:"id"`
	InstanceCount  int            `xml:"instancecount"`
	FinCount       int            `xml:"fincount"`
	RadiusOffset   RadiusOffset   `xml:"radiusoffset"`
	AngleOffset    AngleOffset    `xml:"angleoffset"`
	Rotation       float64        `xml:"rotation"`
	AxialOffset    AxialOffset    `xml:"axialoffset"`
	Position       Position       `xml:"position"`
	Finish         string         `xml:"finish"`
	Material       Material       `xml:"material"`
	Thickness      float64        `xml:"thickness"`
	CrossSection   string         `xml:"crosssection"`
	Cant           float64        `xml:"cant"`
	TabHeight      float64        `xml:"tabheight"`
	TabLength      float64        `xml:"tablength"`
	TabPositions   []TabPosition  `xml:"tabposition"`
	FilletRadius   float64        `xml:"filletradius"`
	FilletMaterial FilletMaterial `xml:"filletmaterial"`
	RootChord      float64        `xml:"rootchord"`
	TipChord       float64        `xml:"tipchord"`
	SweepLength    float64        `xml:"sweeplength"`
	Height         float64        `xml:"height"`
}

TrapezoidFinset represents the trapezoid finset element of the XML document

func (*TrapezoidFinset) GetMass

func (t *TrapezoidFinset) GetMass() float64

GetMass calculates mass based on material density and dimensions

func (*TrapezoidFinset) String

func (t *TrapezoidFinset) String() string

String returns full string representation of the TrapezoidFinset

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL