Ejemplo n.º 1
0
    UAVSimulation
    UAVSimulation::update(const double& timestep)
    {
      //! Check if model has the required commands
      //! - Airspeed
      if (!m_airspeed_cmd_ini)
      {
        throw Error("Airspeed command missing! The state was not updated.");
        //inf("No model parameters defined! The state was not updated.");
        return *this;
      }

      if (m_sim_type == "4DOF_bank")
        update4DOF_Bank(timestep);
      else if (m_sim_type == "5DOF")
      {
        if (m_altitude_cmd_ini)
          update5DOF(timestep);
        else
          throw Error("Altitude command missing! The state was not updated.");
      }
      else if (m_sim_type == "4DOF_alt")
      {
        if (m_altitude_cmd_ini)
          update4DOF_Alt(timestep);
        else
          throw Error("Altitude command missing! The state was not updated.");
      }
      else if (m_sim_type == "3DOF")
        update3DOF(timestep);

      return *this;
    }
Ejemplo n.º 2
0
Archivo: UAV.cpp Proyecto: HSOFEUP/dune
    UAVSimulation
    UAVSimulation::update(const double& timestep)
    {
      //! Check if model has the required commands
      //! - Airspeed
      if (!m_airspeed_cmd_ini)
      {
        throw Error("Airspeed command missing! The state was not updated.");
        //inf("No model parameters defined! The state was not updated.");
        return *this;
      }

      //! Time step control
      double d_timestep;
      if (m_timestep_lim > 0.0 && timestep > m_timestep_lim)
        d_timestep = m_timestep_lim;
      else
        d_timestep = timestep;

      if (m_sim_type.compare("4DOF_bank") == 0)
        update4DOF_Bank(d_timestep);
      else if (m_sim_type.compare("5DOF") == 0)
      {
        if (m_altitude_cmd_ini || m_fpa_cmd_ini)
          update5DOF(d_timestep);
        else
          throw Error("Altitude command missing! The state was not updated.");
      }
      else if (m_sim_type.compare("4DOF_alt") == 0)
      {
        if (m_altitude_cmd_ini || m_fpa_cmd_ini)
          update4DOF_Alt(d_timestep);
        else
          throw Error("Altitude command missing! The state was not updated.");
      }
      else if (m_sim_type.compare("3DOF") == 0)
        update3DOF(d_timestep);
      //else if (m_sim_type.compare("6DOF_stab") == 0)
      //  update6DOF_Stab(d_timestep);

      return *this;
    }