#pragma once #include "vtvsub.h" class Joint; //########################################################################## //################## Thruster::SubsystemResource ##################### //########################################################################## struct Thruster__SubsystemResource: public Subsystem::SubsystemResource { int jointIndex; Scalar maxThrusterRotationRate; Logical primeThruster; }; //########################################################################## //################### Thruster::UpdateRecord #################### //########################################################################## struct Thruster__UpdateRecord : public VTVSubsystem::UpdateRecord { Scalar thrusterRotation; }; //########################################################################## //############################ Thruster ############################## //########################################################################## class Thruster: public Subsystem { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Shared Data support // public: static Derivation *GetClassDerivations(); static SharedData DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Message Support // #if 0 private: static const HandlerEntry MessageHandlerEntries[]; protected: static MessageHandlerSet MessageHandlers; #endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Attribute Support // public: enum { ThrusterOffsetAttributeID = Subsystem::NextAttributeID, ThrusterPositionAttributeID, CurrentAccelerationAttributeID, CurrentHeightAttributeID, MaxThrusterRotationRateAttributeID, MomentArmAttributeID, MomentArmLengthAttributeID, NextAttributeID }; private: static const IndexEntry AttributePointers[]; protected: //static AttributeIndexSet AttributeIndex static AttributeIndexSet& GetAttributeIndex(); // // public attribute declarations go here // public: Point3D thrusterOffset; Joint *thrusterPosition; Scalar currentAcceleration, currentHeight, maxThrusterRotationRate, powerScale, momentArmLength; Vector3D momentArm; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Model Support // public: typedef void (Thruster::*Performance)(Scalar time_slice); typedef Thruster__UpdateRecord UpdateRecord; void PrimeThruster(Scalar time_slice); void SlaveThruster(Scalar time_slice); void PrimeDeadReckon(Scalar time_slice); void SlaveDeadReckon(Scalar time_slice); void SetPerformance(Performance performance) { Check(this); activePerformance = (Simulation::Performance)performance; } VTV* GetEntity() {Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());} protected: void WriteUpdateRecord(Simulation::UpdateRecord *message, int update_model); void ReadUpdateRecord(Simulation::UpdateRecord *message); Scalar updatedPosition; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction and Destruction // public: typedef Thruster__SubsystemResource SubsystemResource; Thruster( VTV *owner, int subsystem_ID, SubsystemResource *subsystem_resource ); ~Thruster(); Logical TestInstance() const; };