e9f4fc5972
> > Here's a patch to add manual-pitch control to the propeller in YASim. A new > > control axis "PROPPITCH" is added. Requires "manual-pitch" boolean property > > in the "propeller" tag. > > > > Tags and Properties to add in order to enable: > > > > manual-pitch="true" > > > > <control-input axis="/controls/engines/engine[0]/propeller-pitch" > > control="PROPPITCH" src0="0" src1="1" dst0="0.40" dst1="0.80"/> > > > > Note that for the time being, excessively low RPM or excessively high RPM is > > brought undercontrol by a scaling range defined in the control-input tag > > (see "dst0" and "dst1" properties).
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
#ifndef _PROPENGINE_HPP
|
|
#define _PROPENGINE_HPP
|
|
|
|
#include "Thruster.hpp"
|
|
|
|
namespace yasim {
|
|
|
|
class Propeller;
|
|
class PistonEngine;
|
|
|
|
class PropEngine : public Thruster {
|
|
public:
|
|
PropEngine(Propeller* prop, PistonEngine* eng, float moment);
|
|
virtual ~PropEngine();
|
|
|
|
void setMagnetos(int magnetos);
|
|
void setAdvance(float advance);
|
|
void setPropPitch(float proppitch);
|
|
void setVariableProp(float min, float max);
|
|
|
|
virtual PropEngine* getPropEngine() { return this; }
|
|
virtual PistonEngine* getPistonEngine() { return _eng; }
|
|
virtual Propeller* getPropeller() { return _prop; }
|
|
|
|
// Dynamic output
|
|
virtual bool isRunning();
|
|
virtual bool isCranking();
|
|
virtual void getThrust(float* out);
|
|
virtual void getTorque(float* out);
|
|
virtual void getGyro(float* out);
|
|
virtual float getFuelFlow();
|
|
|
|
// Runtime instructions
|
|
virtual void init();
|
|
virtual void integrate(float dt);
|
|
virtual void stabilize();
|
|
|
|
float getOmega();
|
|
|
|
private:
|
|
float _moment;
|
|
Propeller* _prop;
|
|
PistonEngine* _eng;
|
|
|
|
bool _variable;
|
|
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
|
float _advance; // control input, 0-1
|
|
float _maxOmega;
|
|
float _minOmega;
|
|
|
|
float _omega; // RPM, in radians/sec
|
|
float _thrust[3];
|
|
float _torque[3];
|
|
float _gyro[3];
|
|
float _fuelFlow;
|
|
};
|
|
|
|
}; // namespace yasim
|
|
#endif // _PROPENGINE_HPP
|