void fms_state::update(double time, double /*dt*/) { // if (phys_transition_start_ && time > *phys_transition_start_ + phys_transition_time_) // { // freeze_chassis_group(); // phys_aircraft_.reset(); // phys_transition_start_.reset(); // visit_chassis([](shassis_group_t const&, shassis_t & shassis) // { // shassis.clear_wheels(); // }); // } // sync_nodes_manager_with_fms(time); auto fms_pos = self_.fms_pos(); self_.set_desired_nm_pos(fms_pos.pos); self_.set_desired_nm_orien(fms_pos.orien); if (fms_pos.pos.height > 1) self_.set_nm_angular_smooth(25); else self_.set_nm_angular_smooth(5); airport::info_ptr airprt = self_.get_airports_manager()->find_closest_airport(fms_pos.pos); // transitions if (!self_.is_fast_session() && !phys_aircraft_failed_ && fms_pos.pos.height < /*phys_state::*/phys_height() - 1 && self_.phys_control()->get_zone(fms_pos.pos)) { optional<size_t> phys_zone = self_.phys_control()->get_zone(fms_pos.pos); if (phys_zone) { auto base = self_.phys_control()->get_base(*phys_zone); auto phys_sys = self_.phys_control()->get_system(*phys_zone); // FIXME we need it phys_aircraft_ptr phys_aircraft = phys_aircraft_impl::create(base, phys_sys, /*self_.get_meteo_cursor(),*/ self_.get_nodes_manager(), self_.fms_pos(), *self_.get_fms_info()->fsettings(), self_.get_shassis(), *phys_zone); if (phys_aircraft) { if (!cg::eq_zero(fms_pos.pos.height)) self_.switch_sync_state(boost::make_shared<transition_fms_phys_state>(self_, phys_aircraft, base, time)); else self_.switch_sync_state(/*boost::make_shared<phys_state>*/create_sync_phys_state(self_, phys_aircraft, base)); } } } else if (cg::distance2d(airprt->pos(), fms_pos.pos) > none_state::sync_none_dist) { self_.switch_sync_state(boost::make_shared<none_state>(self_)); } }
void transition_fms_phys_state::update(double time, double /*dt*/) { if (!phys_aircraft_) return; double const transition_time = 5; FIXME("Наверное очень нужный код"); //fms::procedure_model_ptr pm = self_.get_fms_info()->procedure_model(); //double prediction = cg::clamp(pm->taxi_TAS(), pm->takeoff_TAS(), 15., 30.)(self_.get_fms_info()->get_state().dyn_state.TAS); //geo_base_3 predict_pos = geo_base_3(aircraft_fms::model_info_ptr(self_.get_fms_info())->prediction(prediction*0.1)); //phys_aircraft_->go_to_pos(predict_pos, self_.get_fms_info()->get_state().orien()); //phys_aircraft_->set_air_cfg(self_.get_fms_info()->get_state().dyn_state.cfg); //phys_aircraft_->set_prediction(prediction); //phys_aircraft_->update(); //auto physpos = phys_aircraft_->get_position(); //auto fmspos = self_.fms_pos(); //double t = cg::clamp(start_transition_time_, start_transition_time_ + transition_time, 0., 1.)(time); //auto pos = cg::blend((geo_point_3)fmspos.pos, (geo_point_3)physpos.pos, t); //auto orien = cg::blend(fmspos.orien, physpos.orien, t); //double smooth = cg::blend(25., 2., t); //self_.set_desired_nm_pos(pos); //self_.set_desired_nm_orien(orien); //self_.set_nm_angular_smooth(smooth); //if (time >= start_transition_time_ + transition_time) { self_.switch_sync_state(/*boost::make_shared<phys_state>*/create_sync_phys_state(self_, phys_aircraft_, base_)); } }