Follow the leader
Inheritance: MissionPlanner.Swarm.Swarm
コード例 #1
0
        public FormationControl()
        {
            InitializeComponent();

            SwarmInterface = new Formation();

            bindingSource1.DataSource = MainV2.Comports;

            CMB_mavs.DataSource = bindingSource1;

            updateicons();

            this.MouseWheel += new MouseEventHandler(FollowLeaderControl_MouseWheel);

            MessageBox.Show("this is beta, use at own risk");
        }
コード例 #2
0
        public FormationControl()
        {
            InitializeComponent();

            SwarmInterface = new Formation();

            bindingSource1.DataSource = MainV2.Comports;

            CMB_mavs.DataSource = bindingSource1;

            updateicons();

            this.MouseWheel += new MouseEventHandler(FollowLeaderControl_MouseWheel);

            MessageBox.Show("this is beta, use at own risk");
        }
コード例 #3
0
        public FormationControl()
        {
            InitializeComponent();

            SwarmInterface = new Formation();

            bindingSource1.DataSource = MainV2.Comports;

            CMB_mavs.DataSource = bindingSource1;

            updateicons();

            this.MouseWheel += new MouseEventHandler(FollowLeaderControl_MouseWheel);

            MessageBox.Show("this is beta, use at own risk");

            MissionPlanner.Utilities.Tracking.AddPage(this.GetType().ToString(), this.Text);
        }
コード例 #4
0
        public FormationControl()
        {
            InitializeComponent();

            SwarmInterface = new Formation();

            bindingSource1.DataSource = MainV2.Comports;

            CMB_mavs.DataSource = bindingSource1;

            updateicons();

            this.MouseWheel += new MouseEventHandler(FollowLeaderControl_MouseWheel);

            MessageBox.Show("this is beta, use at own risk");

            MissionPlanner.Utilities.Tracking.AddPage(this.GetType().ToString(), this.Text);
        }
コード例 #5
0
        public FormationControl()
        {
            InitializeComponent();

            SwarmInterface = new Formation();

            TopMost = true;

            Dictionary <String, MAVState> mavStates = new Dictionary <string, MAVState>();

            foreach (var port in MainV2.Comports)
            {
                foreach (var mav in port.MAVlist)
                {
                    mavStates.Add(port.BaseStream.PortName + " " + mav.sysid + " " + mav.compid, mav);
                }
            }

            if (mavStates.Count == 0)
            {
                return;
            }

            bindingSource1.DataSource = mavStates;

            CMB_mavs.DataSource    = bindingSource1;
            CMB_mavs.ValueMember   = "Value";
            CMB_mavs.DisplayMember = "Key";

            updateicons();

            this.MouseWheel += new MouseEventHandler(FollowLeaderControl_MouseWheel);

            MessageBox.Show("this is beta, use at own risk");

            MissionPlanner.Utilities.Tracking.AddPage(this.GetType().ToString(), this.Text);
        }
コード例 #6
0
ファイル: FormationControl.cs プロジェクト: MikeCaptain/swarm
        private void myButton1_Click(object sender, EventArgs e)
        {
            Formation formation = new Formation();

            double[] b = { 126.633247, 45.629651, 3 };

            formation.CollectStartCoords(b);
            formation.StartUTMCoords = formation.GEOsToUTMs(formation.StartGEOCoords, formation.StartGEOCoords[0]);
            formation.BuildEndCoords(0, 20, 3);
            formation.EndGEOCoords = formation.UTMsToGEOs(formation.EndUTMCoords, formation.StartGEOCoords[0]);
            /*
            label3.Text = a.endGEOCoords[0][0] + " " + a.endGEOCoords[0][1] + " " + a.endGEOCoords[0][2] + "";
            MessageBox.Show(a.endGEOCoords[0][0] + " " + a.endGEOCoords[0][1] + " " + a.endGEOCoords[0][2] + "");
            */

            //设计完线路在执行该对策之前,对对策队列“查重”,若有重复,则弃用该队列,执行最简单的贪心算法,保证无失事
            {

            }

            int[] wingRoute = formation.DesignPath(MainV2.Comports.Count);
            int[] formationRoute = new int[wingRoute.Length + 1];//i存储初始编队编号,formationRoute[i]对应目的编号,相对于wingRoute,多了个长机(0位置)
            for (int i = 0; i < wingRoute.Length; i++)
            {
                for (int j = 0; j < wingRoute.Length; j++)
                {
                    if (wingRoute[j] == i)
                        formationRoute[i + 1] = j + 1;
                }
            }

            //任务list添加任务、坐标list添加坐标,编制任务list
            planList.Add(BuildTaskList("guide"));
            planList.Add(BuildTaskList(formationRoute, MAVLink.MAV_CMD.WAYPOINT, formation.EndGEOCoords, WPStyle.OnlyHigher));
            planList.Add(BuildTaskList(formationRoute, MAVLink.MAV_CMD.WAYPOINT, formation.EndGEOCoords, WPStyle.WayPoint));
            planList.Add(BuildTaskList(formationRoute, MAVLink.MAV_CMD.WAYPOINT, formation.EndGEOCoords, WPStyle.KeepLevel));

            //开启执行线程,每当任务规划列表内完成某一段任务时才继续执行下一任务            
            while (planList.Count > 0)
            {
                //开启监测线程
                Thread checkThread = new Thread(new ThreadStart(CheckState));
                Thread doTaskThread = new Thread(new ParameterizedThreadStart(DoPlan));
                checkThread.Start();
                doTaskThread.Start(planList[0]);
                checkThread.Join();//在监测线程完成任务即编队任务完成时才继续执行下一任务点
            }
            
        }