示例#1
0
        public MainPanel(string mw_SerialPort,string rx_SerialPort)
        {
            InitializeComponent();
            if (!String.IsNullOrEmpty(rx_SerialPort))
            {
                rx_profiler = new Profiler(this, init_display_rx, update_display_rx);
                RC_driver = new serial_driver(rx_SerialPort, this, rx_profiler, stream_source.RC_transmitter);
                rx_status.Text = "Open";
            }
            else
            {
                rx_status.Text = "Not Available";
            }
            System.Threading.Thread.Sleep(1000);
            if (!String.IsNullOrEmpty(mw_SerialPort))
            {
                mw_profiler = new Profiler(this, init_display_mw, update_display_mw);
                hardware_driver = new serial_driver(mw_SerialPort, this, mw_profiler, stream_source.flight_controller);
                mw_commander = new commander();
                lblStrip_mw_status.Text = "Open";
            }
            else
            {
                lblStrip_mw_status.Text = "Not Available";
            }
            msg_ctrl_main = new msg_ctrl(hardware_driver.SerialParser, stream_source.flight_controller);
            msg_ctrl_main.DebugTextReceived += new msg_ctrl.DebugTextReceivedHandler(this.OnDebugTextReceived);
            mw_profiler.AttachProbeReceivedEvent();
            display_adapter_main = new dispaly_adapter(this,mw_profiler, attitudeIndicatorInstrument, rollRateInstrument);
            display.Smoothing = System.Drawing.Drawing2D.SmoothingMode.None;
            display.Refresh();
            //int tmp = Thread.CurrentThread.ManagedThreadId;
            display.PlaySpeed = 0.05f;
            session_organizer_main = new session_organizer(treeView_mrft, hardware_driver, mw_commander, msg_ctrl_main);
            flight_scenario_main = new flight_scenario(0, session_organizer_main, listViewFlightScenario, lbl_status_txt,lblStrip_mw_status,lst_flight_history, this);
            //TODO: Optimize this
            session_display_manager_main = new session_display_manager(barBeta, barAmp, barBias,txt_mrft_session_cmnt,
                txt_point_comment,txt_num_mrft_bags, chart_mrft,chart_mrft_session, tabControlTune,combo_tune_method,combo_model_type,
                combo_pid_optim, listViewMRFTPoints,barProp,barIntegral, barDerivative,barWindup,chk_en_pv_derive,
                chk_get_bias, txt_pid_comment,combo_cmd_type,combo_ref_src,txt_beta_val,txt_amp_val,txt_bias_val,
                session_organizer_main);
            DisplayUpdateTimer = new Timer();
            DisplayUpdateTimer.Interval = 100;
            DisplayUpdateTimer.Start();
            DisplayUpdateTimer.Tick += new EventHandler(OnDisplayRefreshTimerTick);

        }
 //Constructor:
 public session_organizer(TreeView tree_view_para,serial_driver mw_serial_driver_para,
     commander mw_commander_para,msg_ctrl msg_ctrls_para)
 {
     if (msg_ctrls_para.MsgStreamSource.Equals(stream_source.flight_controller))
         {
             _msg_ctrl = msg_ctrls_para;
         }
      _mw_serial_driver=mw_serial_driver_para;
      _mw_commander = mw_commander_para;
     tree_view_ctrl = tree_view_para;
 }
示例#3
0
 //Constructor:
 public ReferenceSource(int id_para, session_organizer organizer_para,
     commander.reference_source reference_source_para = commander.reference_source.user_input)
 {
     _organizer = organizer_para;
     _reference_source = (int)reference_source_para;
     ID = id_para;
     Node.Name = "Reference_Source_element_" + ID;
     Node.Text = "Reference_Source_element_" + ID;
     Node.Tag = "Reference_Source_element";
 }
示例#4
0
 //Methods:
 public void perform(commander.ctrl_channel ctrl_chnl_para)
 {
     //First step
     Debug.WriteLine(string.Format("MRFT Perform started {0}", DateTime.Now.ToLongTimeString()));
     _ctrl_chnl = ctrl_chnl_para;
     _organizer.MWMsgCtrl.AckSettingUpdateReceived += OnAckIntialSettingUpdateReceived;
     while (!mrft_points[_perform_counter].Is_included)
     {
         _perform_counter++;
     }
     update_mrft_point_settings(mrft_points[_perform_counter]);
     TimeOutWatch.Interval = session_organizer.timeOutInterval;
     TimeOutWatch.Start();
     ElementStatusUpdateEventArgs eStatus = new ElementStatusUpdateEventArgs();
     eStatus.Status = string.Format("Element {0} started performing",this.Node.Name);
     ElementStatusUpdateEvent(this, eStatus);
 }
示例#5
0
 public void perform(commander.ctrl_channel ctrl_chnl_para)
 {
     ElementStatusUpdateEventArgs eStatus = new ElementStatusUpdateEventArgs();
     eStatus.Status = string.Format("Perform started of {0} at {1}", this.Node.Text, DateTime.Now.ToString("HH:mm:ss.fff"));
     ElementStatusUpdateEvent(this, eStatus);
     _ctrl_chnl = ctrl_chnl_para;
     _organizer.MWMsgCtrl.AckSettingUpdateReceived += OnAckSettingUpdate;
     update_pid_settings();
     //Timer:
     TimeOutWatch = new Timer();
     TimeOutWatch.Tick += OnTimeOut;
     TimeOutWatch.Interval = session_organizer.timeOutInterval;
     TimeOutWatch.Start();
 }
示例#6
0
 //Methods:
 public void perform(commander.ctrl_channel ctrl_chnl_para)
 {
     _ctrl_chnl = ctrl_chnl_para;
     ElementStatusUpdateEventArgs eStatus = new ElementStatusUpdateEventArgs();
     eStatus.Status = string.Format("Perform started of {0} at {1}", this.Node.Text, DateTime.Now.ToString("HH:mm:ss.fff"));
     ElementStatusUpdateEvent(this, eStatus);
     _organizer.MWMsgCtrl.AckCommandReceived += OnAckCommandReceived;
     _msgID = _organizer.MWCommander.AckID;
     LastMessage = _organizer.MWCommander.issue_cmd(CommandType, 0,ctrl_chnl_para);//1: true
     _organizer.MWSerialDriver.serial_send(LastMessage);
     //Timer:
     TimerOutWatch = new Timer();
     TimerOutWatch.Tick += OnTimeOut;
     TimerOutWatch.Interval = session_organizer.timeOutInterval;
     TimerOutWatch.Start();
 }
示例#7
0
 //Constructor:
 public CommandElement(int id_para, session_organizer organizer_para,
     commander.cmd_type cmd_type_para = commander.cmd_type.arm)
 {
     _organizer = organizer_para;
     _cmd_type = cmd_type_para;
     ID = id_para;
     Node.Name = "Command_element_" + ID;
     Node.Text = "Command_element_" + ID;
     Node.Tag = "Command_element";
 }