本文整理汇总了C++中jsbsim::FGFCS::SetRollTrimCmd方法的典型用法代码示例。如果您正苦于以下问题:C++ FGFCS::SetRollTrimCmd方法的具体用法?C++ FGFCS::SetRollTrimCmd怎么用?C++ FGFCS::SetRollTrimCmd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsbsim::FGFCS
的用法示例。
在下文中一共展示了FGFCS::SetRollTrimCmd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dynamics
//------------------------------------------------------------------------------
// dynamics() -- update player's vehicle dynamics
//------------------------------------------------------------------------------
void JSBSimModel::dynamics(const LCreal dt)
{
// Get our Player (must have one!)
Simulation::Player* p = static_cast<Simulation::Player*>( findContainerByType(typeid(Simulation::Player)) );
if (p == 0) return;
if (fdmex == 0) return;
JSBSim::FGPropagate* Propagate = fdmex->GetPropagate();
if (Propagate == 0) return;
JSBSim::FGFCS* FCS = fdmex->GetFCS();
if (FCS == 0) return;
JSBSim::FGAccelerations* Accelerations = fdmex->GetAccelerations();
if (Accelerations == 0) return;
pitchTrimPos += pitchTrimRate * pitchTrimSw * dt;
if (pitchTrimPos > 1.0) {
pitchTrimPos = 1.0;
} else if (pitchTrimPos < -1.0) {
pitchTrimPos = -1.0;
}
FCS->SetPitchTrimCmd(pitchTrimPos);
rollTrimPos += rollTrimRate * rollTrimSw * dt;
if (rollTrimPos > 1.0) {
rollTrimPos = 1.0;
} else if (rollTrimPos < -1.0) {
rollTrimPos = -1.0;
}
FCS->SetRollTrimCmd(rollTrimPos);
fdmex->Setdt(dt);
// ---
// Pass flags & Data
// ---
#if 0
// CGB TBD
if (isFrozen() || dt == 0) freeze = -1;
else freeze = 0;
if (isPositionFrozen()) posFrz = -1;
else posFrz = 0;
if (isAltitudeFrozen()) altFrz = -1;
else altFrz = 0;
if (isFuelFrozen()) fuelFrz = -1;
else fuelFrz = 0;
rw_elev = getTerrainElevationFt();
#endif
// ---
// Run the model
// ---
fdmex->Run(); //loop JSBSim once w/o integrating
// ---
// Set values for Player & AirVehicle interfaces
// (Note: Player::dynamics() computes the new position)
// ---
p->setAltitude(Basic::Distance::FT2M * Propagate->GetAltitudeASL(), true);
p->setVelocity((LCreal)(Basic::Distance::FT2M * Propagate->GetVel(JSBSim::FGJSBBase::eNorth)), (LCreal)(Basic::Distance::FT2M * Propagate->GetVel(JSBSim::FGJSBBase::eEast)), (LCreal)(Basic::Distance::FT2M * Propagate->GetVel(JSBSim::FGJSBBase::eDown)));
p->setVelocityBody((LCreal)(Basic::Distance::FT2M * Propagate->GetUVW(1)), (LCreal)(Basic::Distance::FT2M * Propagate->GetUVW(2)), (LCreal)(Basic::Distance::FT2M * Propagate->GetUVW(3)));
// LCreal accX = Basic::Distance::FT2M * Propagate->GetUVWdot(1);
// LCreal accY = Basic::Distance::FT2M * Propagate->GetUVWdot(2);
// LCreal accZ = Basic::Distance::FT2M * Propagate->GetUVWdot(3);
const JSBSim::FGMatrix33& Tb2l = Propagate->GetTb2l();
const JSBSim::FGColumnVector3& vUVWdot = Accelerations->GetUVWdot();
p->setEulerAngles((LCreal)(Propagate->GetEuler(JSBSim::FGJSBBase::ePhi)), (LCreal)(Propagate->GetEuler(JSBSim::FGJSBBase::eTht)), (LCreal)(Propagate->GetEuler(JSBSim::FGJSBBase::ePsi)));
p->setAngularVelocities((LCreal)(Propagate->GetPQR(JSBSim::FGJSBBase::eP)), (LCreal)(Propagate->GetPQR(JSBSim::FGJSBBase::eQ)), (LCreal)(Propagate->GetPQR(JSBSim::FGJSBBase::eR)));
JSBSim::FGColumnVector3 vVeldot = Tb2l * vUVWdot;
p->setAcceleration((LCreal)(Basic::Distance::FT2M * vVeldot(1)), (LCreal)(Basic::Distance::FT2M * vVeldot(2)), (LCreal)(Basic::Distance::FT2M * vVeldot(3)));
//std::printf("(%6.1f, %6.1f, %6.1f) vel=%8.1f alt=%8.1f alt2=%8.1f\n", acData->phi, acData->theta, acData->psi, acData->vp, acData->hp, (M2FT*getAltitude()) );
//std::printf("f=%6.1f p=%6.1f, qa=%6.1f, a=%6.1f, g=%6.1f\n", hotasIO->pitchForce, acData->theta, acData->qa, acData->alpha, acData->gamma );
//{
// std::cout << "JSBSim: ---------------------------------" << std::endl;
// osg::Vec4 fq;
// fq.set(acData->e1, acData->e2, acData->e4, acData->e4);
// osg::Matrix m2;
// m2.set(
// acData->l1, acData->l2, acData->l3, 0,
// acData->m1, acData->m2, acData->m3, 0,
// acData->n1, acData->n2, acData->n3, 0,
// 0, 0, 0, 1
// );
// std::printf("Eaagles*EA: (%6.1f, %6.1f, %6.1f)\n", getRollD(), getPitchD(), getHeadingD());
// osg::Matrix m0 = getRotationalMatrix();
// osg::Quat q0 = getQuaternions();
// setRotationalMatrix(m2);
// //setQuaternions(fq);
// osg::Quat eq = getQuaternions();
//.........这里部分代码省略.........