コード例 #1
0
        public GyroCal(AHRS sensor)
        {
            int i = 0;

            InitializeComponent();

            this.sensor = sensor;

            // Add DataReceived event handler.
            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);
            sensor.confReceivedEvent += new confReceivedDelegate(confReceivedEventHandler);
            confReceivedEventHandler(i);

            data_collection_enabled = false;
            next_data_index = 0;

            loggedData = new double[SAMPLES, 3];
            threshold = 1.5 * 3.14159 / 180;

            bias = new double[3];

            calMat = new double[3, 3];
            calMat[0, 0] = 1.0;
            calMat[1, 1] = 1.0;
            calMat[2, 2] = 1.0;

            D = new GeneralMatrix(SAMPLES, 10);

            for (i = 0; i < SAMPLES; i++)
            {
                loggedData[i,0] = 0;
                loggedData[i, 1] = 0;
                loggedData[i, 2] = 0;
            }
        }
コード例 #2
0
        public AHRSInterface()
        {
            InitializeComponent();

            initializeSerialPort();

            sensor = new AHRS();

            // Set up event handlers
            sensor.PacketTimeoutEvent += new StateDelegate(TimeoutEventHandler);
            sensor.PacketReceivedEvent += new PacketDelegate(PacketReceivedEventHandler);
            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);
            sensor.PacketSentEvent += new PacketDelegate(PacketSentEventHandler);
            sensor.COMFailedEvent += new COMFailedDelegate(COMFailedEventHandler);

            renderTimer = new Timer();

            renderTimer.Interval = 10;
            renderTimer.Enabled = true;
            renderTimer.Tick += new System.EventHandler(OnRenderTimerTick);

            //Form_3Dcuboid form_3DcuboidA = new Form_3Dcuboid(new string[] { "RightInv.png", "LeftInv.png", "BackInv.png", "FrontInv.png", "TopInv.png", "BottomInv.png" });
            form_3DcuboidA.Text += " A";
            BackgroundWorker backgroundWorkerA = new BackgroundWorker();

            backgroundWorkerA.DoWork += new DoWorkEventHandler(delegate { form_3DcuboidA.ShowDialog(); });

            backgroundWorkerA.RunWorkerAsync();
        }
コード例 #3
0
        public AHRSInterface()
        {
            InitializeComponent();

            initializeSerialPort();

            sensor = new AHRS();

            // Set up event handlers
            sensor.PacketTimeoutEvent += new StateDelegate(TimeoutEventHandler);
            sensor.PacketReceivedEvent += new PacketDelegate(PacketReceivedEventHandler);
            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);
            sensor.PacketSentEvent += new PacketDelegate(PacketSentEventHandler);
            sensor.COMFailedEvent += new COMFailedDelegate(COMFailedEventHandler);
            sensor.PacketLabelEvent += new PacketLabel(PacketLabelHandler);

            renderTimer = new Timer();

            renderTimer.Interval = 20;
            renderTimer.Enabled = true;
            renderTimer.Tick += new System.EventHandler(OnRenderTimerTick);

            Pos_Pane = PosGraph.GraphPane;
            Pos_Pane.Title.Text = "Position controller";
            Pos_Pane.XAxis.Title.Text = "Time (s)";
            Pos_Pane.YAxis.Title.Text = "Output";

            Vel_Pane = VelGraph.GraphPane;
            Vel_Pane.Title.Text = "Velocity controller";
            Vel_Pane.XAxis.Title.Text = "Time (s)";
            Vel_Pane.YAxis.Title.Text = "Output";

            Cur_Pane = CurGraph.GraphPane;
            Cur_Pane.Title.Text = "Current controller";
            Cur_Pane.XAxis.Title.Text = "Time (s)";
            Cur_Pane.YAxis.Title.Text = "Output";

            Pos_Tar_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);
            Pos_Motor_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);

            Vel_Ext_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);
            Vel_Int_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);
            Vel_Motor_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);

            Cur_Ext_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);
            Cur_Int_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);
            Cur_Motor_List = new RollingPointPairList(SENSOR_GRAPH_POINTS);

            Pos_Tar_Line = Pos_Pane.AddCurve("Position Target", Pos_Tar_List, Color.Blue, SymbolType.None);
            Pos_Motor_Line = Pos_Pane.AddCurve("Motor position", Pos_Motor_List, Color.Red, SymbolType.None);

            Vel_Ext_Line = Vel_Pane.AddCurve("External Velocity", Vel_Ext_List, Color.Blue, SymbolType.None);
            Vel_Int_Line = Vel_Pane.AddCurve("Internal Velocity", Vel_Int_List, Color.Red, SymbolType.None);
            Vel_Motor_Line = Vel_Pane.AddCurve("Motor Velocity", Vel_Motor_List, Color.Green, SymbolType.None);

            Cur_Ext_Line = Cur_Pane.AddCurve("External Current", Cur_Ext_List, Color.Blue, SymbolType.None);
            Cur_Int_Line = Cur_Pane.AddCurve("Internal Current", Cur_Int_List, Color.Red, SymbolType.None);
            Cur_Motor_Line = Cur_Pane.AddCurve("Motor Current", Cur_Motor_List, Color.Green, SymbolType.None);
        }
コード例 #4
0
        public AHRSLog(AHRS sensor)
        {
            InitializeComponent();

            //loggingEnabled = false;
            loggingEnabled = true;
            this.sensor = sensor;

            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);
        }
コード例 #5
0
        public ConfSet(AHRS sensor)
        {
            int i=0;

            InitializeComponent();

            this.sensor = sensor;
            // Add DataReceived event handler.
            sensor.confReceivedEvent += new confReceivedDelegate(confReceivedEventHandler);
            confReceivedEventHandler(i);
        }
コード例 #6
0
        public InfoDump( AHRS sensor )
        {
            InitializeComponent();

            this.sensor = sensor;

            // Add new event handlers
            sensor.PacketReceivedEvent += new PacketDelegate(PacketReceivedEventHandler);
            sensor.PacketTimeoutEvent += new StateDelegate(TimeoutEventHandler);
            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);

            displayAHRSStates();

            initializeGraphs();

            timer1.Interval = 50;
            timer1.Start();
            time = 0;
        }
コード例 #7
0
        public calcVar(AHRS sensor)
        {
            int i = 0;

            InitializeComponent();

            this.sensor = sensor;

            // Add DataReceived event handler.
            sensor.DataReceivedEvent += new DataReceivedDelegate(DataReceivedEventHandler);

            data_collection_enabled = false;
            next_data_index = 0;

            accxdata = new double[SAMPLES];
            accydata = new double[SAMPLES];
            acczdata = new double[SAMPLES];
            magxdata = new double[SAMPLES];
            magydata = new double[SAMPLES];
            magzdata = new double[SAMPLES];
            gyroxdata = new double[SAMPLES];
            gyroydata = new double[SAMPLES];
            gyrozdata = new double[SAMPLES];

            calMat = new double[3, 3];
            calMat[0, 0] = 1.0;
            calMat[1, 1] = 1.0;
            calMat[2, 2] = 1.0;

            for (i = 0; i < SAMPLES; i++)
            {
                 accydata[i]=0;
                 acczdata[i] = 0;
                 magxdata[i] = 0;
                 magydata[i] = 0;
                 magzdata[i] = 0;
                 gyroxdata[i] = 0;
                 gyroydata[i] = 0;
                 gyrozdata[i] = 0;
            }
        }
コード例 #8
0
        public AHRSupload(AHRS sensor)
        {
            InitializeComponent();

            this.sensor = sensor;
        }
コード例 #9
0
 public saveconfiguration(AHRS sensor)
 {
     InitializeComponent();
     this.sensor = sensor;
 }