#include "Ground.hpp"
#include "Rotor.hpp"
-#include STL_IOSTREAM
-#include STL_IOMANIP
+#include <iostream>
+#include <iomanip>
-SG_USING_STD(setprecision);
+using std::setprecision;
#ifdef TEST_DEBUG
#include <stdio.h>
_max_tilt_yaw=0;
_max_tilt_pitch=0;
_max_tilt_roll=0;
+ _downwash_factor=1;
}
Rotor::~Rotor()
_rel_len_hinge=value;
}
+void Rotor::setDownwashFactor(float value)
+{
+ _downwash_factor=value;
+}
+
void Rotor::setAlphaoutput(int i, const char *text)
{
strncpy(_alphaoutput[i],text,255);
for(i=0; i<4; i++) _global_ground[i] = global_ground[i];
}
-void Rotor::setParameter(char *parametername, float value)
+void Rotor::setParameter(const char *parametername, float value)
{
#define p(a,b) if (strcmp(parametername,#a)==0) _##a = (value * (b)); else
p(translift_ve,1)
_cyclicail=-(_mincyclicail+(lval+1)/2*(_maxcyclicail-_mincyclicail));
}
+void Rotor::setRotorBalance(float lval)
+{
+ lval = Math::clamp(lval, -1, 1);
+ _balance2 = lval;
+}
+
void Rotor::getPosition(float* out)
{
int i;
_f_ge=1+_diameter/_ground_effect_altitude*_ground_effect_constant;
// Now calculate translational lift
- float v_vert = Math::dot3(v,_normal);
+ // float v_vert = Math::dot3(v,_normal);
float help[3];
Math::cross3(v,_normal,help);
float v_horiz = Math::mag3(help);
//store the gravity direction
Glue::geodUp(s->pos, _grav_direction);
+ s->velGlobalToLocal(_grav_direction, _grav_direction);
}
void Rotor::findGroundEffectAltitude(Ground * ground_cb,State *s)
//at dist = rotor radius it is assumed to be 1/e * v1 + (1-1/e)* v2
float v = g * v1 + (1-g) * v2;
- Math::mul3(-v,_normal_with_yaw_roll,downwash);
+ Math::mul3(-v*_downwash_factor,_normal_with_yaw_roll,downwash);
//the downwash is calculated in the opposite direction of the normal
}
* _diameter * _rel_blade_center * _rel_blade_center /(0.5*0.5);
float speed=_rotor_rpm/60*_diameter*_rel_blade_center*pi;
float lentocenter=_diameter*_rel_blade_center*0.5;
- float lentoforceattac=_diameter*_rel_len_hinge*0.5;
+ // float lentoforceattac=_diameter*_rel_len_hinge*0.5;
float zentforce=rotorpartmass*speed*speed/lentocenter;
float pitchaforce=_force_at_pitch_a/_number_of_parts*.453*9.81;
// was pounds of force, now N, devided by _number_of_parts
float relamp=(omega*omega/(2*_delta*Math::sqrt(sqr(omega0*omega0-omega*omega)
+4*_delta*_delta*omega*omega)))*_cyclic_factor;
- float relamp_theoretical=(omega*omega/(2*delta_theoretical*Math::sqrt(sqr(omega0*omega0-omega*omega)
- +4*delta_theoretical*delta_theoretical*omega*omega)))*_cyclic_factor;
+ //float relamp_theoretical=(omega*omega/(2*delta_theoretical*Math::sqrt(sqr(omega0*omega0-omega*omega)
+ // +4*delta_theoretical*delta_theoretical*omega*omega)))*_cyclic_factor;
_phi=Math::acos(_rel_len_hinge);
_phi-=Math::atan(_delta3);
if (!_no_torque)
total_torque+=r->getTorque()*omegan;
}
float max_torque_of_engine=0;
- SGPropertyNode * node=fgGetNode("/rotors/gear", true);
+ // SGPropertyNode * node=fgGetNode("/rotors/gear", true);
if (_engineon)
{
max_torque_of_engine=_max_power_engine*_max_rel_torque;
for(j=0; j<_rotors.size(); j++) {
Rotor* r = (Rotor*)_rotors.get(j);
for(i=0; i<r->_rotorparts.size(); i++) {
- float torque_scalar=0;
+ // float torque_scalar=0;
Rotorpart* rp = (Rotorpart*)r->_rotorparts.get(i);
float torque[3];
rp->getAccelTorque(_ddt_omegarel,torque);
void Rotorgear::compile()
{
- float wgt = 0;
+ // float wgt = 0;
for(int j=0; j<_rotors.size(); j++) {
Rotor* r = (Rotor*)_rotors.get(j);
r->compile();