IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
IMS_ModuleFunctionData_Gear Class Reference

Holds static data to define a piece of landing gear. More...

Inheritance diagram for IMS_ModuleFunctionData_Gear:
IMS_ModuleFunctionData_Base

Public Member Functions

bool HasGui ()
 This function serves to check whether a module function has a GUI before creating it. More...
 
- Public Member Functions inherited from IMS_ModuleFunctionData_Base
virtual bool LoadFromFile (string configfile, IMSFILE cfg)
 Loads the data from config file. More...
 
FUNCTIONTYPE GetType ()
 
string GetName ()
 

Private Member Functions

bool processConfigLine (vector< string > &tokens)
 Receives all lines of the config file that concern this ModuleFunction one by one. More...
 
bool validateData (string configfile)
 Validates the data for completeness after loading. More...
 

Private Attributes

string deployanimname = ""
 
VECTOR3 touchdownpoint = _V(NAN, NAN, NAN)
 
double tdstiffness = 1e6
 
double tddamping = 1e5
 
VECTOR3 tddir = _V(0, 0, -1)
 
bool candeploy = false
 

Friends

class IMS_ModuleFunction_Gear
 

Additional Inherited Members

- Protected Attributes inherited from IMS_ModuleFunctionData_Base
FUNCTIONTYPE type
 Stores the type of the ModuleFunction.
 
string name = ""
 Stores the Name of the ModuleFunction.
 

Detailed Description

Holds static data to define a piece of landing gear.

Config parameters

BEGIN_MODULEFUNCTION GEAR
TdPos = <float x> <float y> <float z> //the position of the DEPLOYED touchdown point, module relative.
TdDir = <float x> <float y> <float z> //the DOWN direction of the touchdown point, module relative, as a normalised vector.
[Deploy-anim] = <string id> //the id of the deployment animation (should be a sequential animation). Optional if is undeployable, in which case it will be considered permanently deployed.
[TdStiffness] = <float> //Suspension stiffness (i.e. how hard it is to compress the suspension). Default is 1e6.
[TdDamping] = <float> //Damping coefficient of the landing gear (how much energy is lost when compressing the suspension). Default is 1e5.
END_MODULEFUNCTION

A note on tdstiffness and tddamping: In general, it is recommendable to leave these alone and let the engineer of the vessel figure out the optimum number of gears to put on his vessel. The values are still here however if somebody wants to make different "weight-classes" of landing gear (for example, gear that is only useful on very massive or very light vessels). The deployment animation has to be defined as a separate IMS_ModuleFunction_Animation in the same cconfig.

config example

BEGIN_MODULEFUNCTION GEAR
deploy_anim = deploy
tdpos = 0 0 -3.4
tddir = 0 0 -1
END_MODULEFUNCTION
See also
IMS_ModuleFunction_Animation

Member Function Documentation

bool IMS_ModuleFunctionData_Gear::HasGui ( )
inlinevirtual

This function serves to check whether a module function has a GUI before creating it.

Note
If your ModuleFunction has its own GUI, overload this function and return true, as simple as that.
Returns
Always false

Reimplemented from IMS_ModuleFunctionData_Base.

bool IMS_ModuleFunctionData_Gear::processConfigLine ( vector< string > &  tokens)
privatevirtual

Receives all lines of the config file that concern this ModuleFunction one by one.

Overload this function to receive the relevant data of your module.

Parameters
tokensa vector of strings that contains the individual parts of the line, delimited by whitespace or '='
Note
Throw runtime_error with an error message if you encounter an invalid line! The message will be loged in Orbiter.log together with the name of the config file.
Returns
true if the passed line was processed, false if not.

Implements IMS_ModuleFunctionData_Base.

bool IMS_ModuleFunctionData_Gear::validateData ( string  configfile)
privatevirtual

Validates the data for completeness after loading.

Implement this function to validate your data at the end of the loading process. Check if everything's there that needs to be, and write log messages if it isn't.

Parameters
configfileThe name of the configfile, so you can add it to your messages so config writers find their mistakes faster.
Returns
False if the modulefunction is unable to function, otherwise return true.
Note
If your Implementation returns false, The loading process will be aborted by forcing orbiter to crash, so be sure to keep your loging straight!

Implements IMS_ModuleFunctionData_Base.


The documentation for this class was generated from the following files: