本文整理汇总了C++中jsbsim::FGFCS::SetPropAdvance方法的典型用法代码示例。如果您正苦于以下问题:C++ FGFCS::SetPropAdvance方法的具体用法?C++ FGFCS::SetPropAdvance怎么用?C++ FGFCS::SetPropAdvance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsbsim::FGFCS
的用法示例。
在下文中一共展示了FGFCS::SetPropAdvance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reset
//------------------------------------------------------------------------------
// reset() --
//------------------------------------------------------------------------------
void JSBSimModel::reset()
{
BaseClass::reset();
pitchTrimPos = (LCreal)0.0;
pitchTrimRate = (LCreal)0.1;
pitchTrimSw = (LCreal)0.0;
rollTrimPos = (LCreal)0.0;
rollTrimRate = (LCreal)0.1;
rollTrimSw = (LCreal)0.0;
// Get our Player (must have one!)
Simulation::Player* p = static_cast<Simulation::Player*>( findContainerByType(typeid(Simulation::Player)) );
if (p == 0) return;
// must have strings set
if (rootDir == 0 || model == 0) return;
// Must also have the JSBSim object
if (fdmex == 0) {
// must have a JSBSim property manager
if (propMgr == 0) {
propMgr = new JSBSim::FGPropertyManager();
}
fdmex = new JSBSim::FGFDMExec(propMgr);
std::string RootDir(rootDir->getString());
fdmex->SetAircraftPath(RootDir + "aircraft");
fdmex->SetEnginePath(RootDir + "engine");
fdmex->SetSystemsPath(RootDir + "systems"); // JSBSim-1.0 or after only
fdmex->LoadModel(model->getString());
JSBSim::FGPropertyManager* propMgr = fdmex->GetPropertyManager();
if (propMgr != 0) {
hasHeadingHold = propMgr->HasNode("ap/heading_hold") && propMgr->HasNode("ap/heading_setpoint");
hasVelocityHold = propMgr->HasNode("ap/airspeed_hold") && propMgr->HasNode("ap/airspeed_setpoint");
hasAltitudeHold = propMgr->HasNode("ap/altitude_hold") && propMgr->HasNode("ap/altitude_setpoint");
#if 0
// CGB this isn't working for some reason. I set the values directly in "dynamics" for now.
if (hasHeadingHold) {
propMgr->Tie("ap/heading_hold", this, &JSBSimModel::isHeadingHoldOn);
propMgr->Tie("ap/heading_setpoint", this, &JSBSimModel::getCommandedHeadingD);
}
if (hasVelocityHold) {
propMgr->Tie("ap/airspeed_hold", this, &JSBSimModel::isVelocityHoldOn);
propMgr->Tie("ap/airspeed_setpoint", this, &JSBSimModel::getCommandedVelocityKts);
}
if (hasAltitudeHold) {
propMgr->Tie("ap/altitude_hold", this, &JSBSimModel::isAltitudeHoldOn);
propMgr->Tie("ap/altitude_setpoint", this, &JSBSimModel::getCommandedAltitude * Basic::Distance::M2FT);
}
#endif
}
}
#if 0
// CGB TBD
reset = 0;
freeze = 0;
#endif
JSBSim::FGInitialCondition* fgic = fdmex->GetIC();
if (fgic == 0) return;
fgic->SetAltitudeASLFtIC(Basic::Distance::M2FT * p->getAltitude());
#if 0
fgic->SetTrueHeadingDegIC(Basic::Angle::R2DCC * p->getHeading());
fgic->SetRollAngleDegIC(Basic::Angle::R2DCC * p->getRoll());
fgic->SetPitchAngleDegIC(Basic::Angle::R2DCC * p->getPitch());
#else
fgic->SetPsiDegIC(Basic::Angle::R2DCC * p->getHeading());
fgic->SetPhiDegIC(Basic::Angle::R2DCC * p->getRoll());
fgic->SetThetaDegIC(Basic::Angle::R2DCC * p->getPitch());
#endif
fgic->SetVtrueKtsIC(Basic::Distance::M2NM * p->getTotalVelocity() * 3600.0f);
fgic->SetLatitudeDegIC(p->getInitLatitude());
fgic->SetLongitudeDegIC(p->getInitLongitude());
JSBSim::FGPropulsion* Propulsion = fdmex->GetPropulsion();
JSBSim::FGFCS* FCS = fdmex->GetFCS();
if (Propulsion != 0 && FCS != 0) {
Propulsion->SetMagnetos(3);
for (unsigned int i=0; i < Propulsion->GetNumEngines(); i++) {
FCS->SetMixtureCmd(i, 1.0);
FCS->SetThrottleCmd(i, 1.0);
FCS->SetPropAdvanceCmd(i, 1.0);
FCS->SetMixturePos(i, 1.0);
FCS->SetThrottlePos(i, 1.0);
FCS->SetPropAdvance(i, 1.0);
JSBSim::FGEngine* eng = Propulsion->GetEngine(i);
eng->SetRunning(true);
JSBSim::FGThruster* thruster = eng->GetThruster();
thruster->SetRPM(1000.0);
}
Propulsion->SetFuelFreeze(p->isFuelFrozen());
Propulsion->InitRunning(-1); // -1 refers to "All Engines"
Propulsion->GetSteadyState();
//.........这里部分代码省略.........