Beispiel #1
0
 public OnlineLinTrainerWindow(OnlineLinTrainer trainer, string name, int wnd_id, Rect window) :
     base(name, wnd_id, window)
 {
     this.trainer = trainer;
 }
        void initialize_lin_tainers()
        {
            // Initial dumb aero values
            if (HasControlSurfaces)
            {
                pitch_aero_torque_model.tpars[2]     = 10.0;
                pitch_aero_torque_model_gen.tpars[2] = 10.0;
                roll_aero_torque_model.tpars[3]      = 10.0;
                roll_aero_torque_model_gen.tpars[3]  = 10.0;
                yaw_aero_torque_model.tpars[2]       = 10.0;
                yaw_aero_torque_model_gen.tpars[2]   = 10.0;
            }
            pitch_lift_model.tpars[2] = sum_mass;
            yaw_lift_model.tpars[2]   = sum_mass;

            //  Initialize pitch rotation trainer
            pitch_aero_torque_task.linmodel          = pitch_aero_torque_model;
            pitch_aero_torque_task.base_gen_weight   = 0.0001f;
            pitch_aero_torque_task.linear_time_decay = 0.005f;
            pitch_aero_torque_task.nonlin_time_decay = 0.01f;
            pitch_aero_torque_task.validator         = (a, b) => pitch_validator(pitch_aero_torque_model, a, b);

            pitch_aero_torque_task_gen.linmodel          = pitch_aero_torque_model_gen;
            pitch_aero_torque_task_gen.base_gen_weight   = 0.5f;
            pitch_aero_torque_task_gen.linear_time_decay = 0.005f;
            pitch_aero_torque_task_gen.nonlin_time_decay = 0.01f;
            pitch_aero_torque_task_gen.validator         = (a, b) => pitch_validator(pitch_aero_torque_model_gen, a, b);

            pitch_trainer = new OnlineLinTrainer(IMM_BUF_SIZE, new double[] { 0.01, 0.05 },
                                                 new int[] { 20, 20 }, pitch_input_method, pitch_output_method, pitch_aero_torque_task_gen, pitch_aero_torque_task);
            pitch_trainer.max_value_decay     = 0.001f;
            pitch_trainer.linear_err_criteria = 0.01f;
            pitch_trainer.nonlin_trigger      = 100;
            pitch_trainer.nonlin_cutoff_time  = 500;

            //  Initialize roll rotation trainer
            roll_aero_torque_task.linmodel          = roll_aero_torque_model;
            roll_aero_torque_task.base_gen_weight   = 0.001f;
            roll_aero_torque_task.linear_time_decay = 0.005f;
            roll_aero_torque_task.nonlin_time_decay = 0.01f;
            roll_aero_torque_task.validator         = (a, b) => roll_validator(roll_aero_torque_model, a, b);

            roll_aero_torque_task_gen.linmodel          = roll_aero_torque_model_gen;
            roll_aero_torque_task_gen.base_gen_weight   = 0.5f;
            roll_aero_torque_task_gen.linear_time_decay = 0.005f;
            roll_aero_torque_task_gen.nonlin_time_decay = 0.01f;
            roll_aero_torque_task_gen.validator         = (a, b) => roll_validator(roll_aero_torque_model_gen, a, b);

            roll_trainer = new OnlineLinTrainer(IMM_BUF_SIZE, new double[] { 0.01, 0.05, 0.05, 0.05 },
                                                new int[] { 15, 15, 15, 15 }, roll_input_method, roll_output_method, roll_aero_torque_task_gen, roll_aero_torque_task);
            roll_trainer.max_value_decay     = 0.001f;
            roll_trainer.linear_err_criteria = 0.02f;
            roll_trainer.nonlin_trigger      = 100;
            roll_trainer.nonlin_cutoff_time  = 500;

            //  Initialize yaw rotation trainer
            yaw_aero_torque_task.linmodel          = yaw_aero_torque_model;
            yaw_aero_torque_task.base_gen_weight   = 0.0001f;
            yaw_aero_torque_task.linear_time_decay = 0.005f;
            yaw_aero_torque_task.nonlin_time_decay = 0.01f;
            yaw_aero_torque_task.validator         = (a, b) => pitch_validator(yaw_aero_torque_model, a, b);

            yaw_aero_torque_task_gen.linmodel          = yaw_aero_torque_model_gen;
            yaw_aero_torque_task_gen.base_gen_weight   = 0.5f;
            yaw_aero_torque_task_gen.linear_time_decay = 0.005f;
            yaw_aero_torque_task_gen.nonlin_time_decay = 0.01f;
            yaw_aero_torque_task_gen.validator         = (a, b) => pitch_validator(yaw_aero_torque_model_gen, a, b);

            yaw_trainer = new OnlineLinTrainer(IMM_BUF_SIZE, new double[] { 0.01, 0.05 },
                                               new int[] { 20, 20 }, yaw_input_method, yaw_output_method, yaw_aero_torque_task_gen, yaw_aero_torque_task);
            yaw_trainer.max_value_decay     = 0.001f;
            yaw_trainer.linear_err_criteria = 0.01f;
            yaw_trainer.nonlin_trigger      = 100;
            yaw_trainer.nonlin_cutoff_time  = 500;

            //  Initialize pitch lift trainer
            pitch_lift_task.linmodel          = pitch_lift_model;
            pitch_lift_task.base_gen_weight   = 2.0f;
            pitch_lift_task.linear_time_decay = 0.002f;
            pitch_lift_task.nonlin_time_decay = 0.005f;
            pitch_lift_task.validator         = (a, b) => pitch_lift_validator(pitch_lift_model, a, b);

            pitch_lift_trainer = new OnlineLinTrainer(IMM_BUF_SIZE, new double[] { 0.01, 0.05 },
                                                      new int[] { 20, 20 }, pitch_lift_input_method, pitch_lift_output_method, pitch_lift_task);
            pitch_lift_trainer.max_value_decay     = 0.0005f;
            pitch_lift_trainer.linear_err_criteria = 0.0005f;
            pitch_lift_trainer.nonlin_trigger      = 100;
            pitch_lift_trainer.nonlin_cutoff_time  = 500;

            //  Initialize yaw lift trainer
            yaw_lift_task.linmodel          = yaw_lift_model;
            yaw_lift_task.base_gen_weight   = 2.0f;
            yaw_lift_task.linear_time_decay = 0.002f;
            yaw_lift_task.nonlin_time_decay = 0.005f;
            yaw_lift_task.validator         = (a, b) => pitch_lift_validator(yaw_lift_model, a, b);

            yaw_lift_trainer = new OnlineLinTrainer(IMM_BUF_SIZE, new double[] { 0.01, 0.05 },
                                                    new int[] { 20, 20 }, yaw_lift_input_method, yaw_lift_output_method, yaw_lift_task);
            yaw_lift_trainer.max_value_decay     = 0.0005f;
            yaw_lift_trainer.linear_err_criteria = 0.001f;
            yaw_lift_trainer.nonlin_trigger      = 100;
            yaw_lift_trainer.nonlin_cutoff_time  = 500;
        }