Пример #1
0
        public RemoteAim(String vcd)
        {
            InitializeComponent();

            VideoCaptureDevice videoSource = new VideoCaptureDevice(vcd, new Size(320, 240), false);

            OpenVideoSource(videoSource);

            redDot.Location    = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
            servos             = new Servos();
            XTextBox.Text      = servos.GetMathPosition().X.ToString();
            YTextBox.Text      = servos.GetMathPosition().Y.ToString();
            redDot.Location    = servos.GetPorportionalMathPosition(gridBox.Bounds);
            redDot.Location    = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
            label1.Text        = "(-" + servos.CenterServosPosition.X + "," + servos.CenterServosPosition.Y + ")";
            PosIncTextBox.Text = positionIncrement.ToString();
            textBoxXServo.Text = servos.ShootingRange.Width.ToString();
            textBoxYServo.Text = servos.ShootingRange.Height.ToString();
            textBoxXCoord.Text = servos.ServosPosition.X.ToString();
            textBoxYCoord.Text = servos.ServosPosition.Y.ToString();

            Packet packet = new Packet(servos.CenterServosPosition);

            packet.setFireOff();
            this.sendData(packet);
        }
Пример #2
0
 public TransmitPosition()
 {
     showErrorFlag = false;
     InitializeComponent();
     //usbHub = new usb_interface();
     redDot.Location    = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
     servos             = new Servos(1630, 1477);
     XTextBox.Text      = servos.GetMathPosition().X.ToString();
     YTextBox.Text      = servos.GetMathPosition().Y.ToString();
     redDot.Location    = servos.GetPorportionalMathPosition(gridBox.Bounds);
     redDot.Location    = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
     label1.Text        = "(-" + servos.ShootingRange.Width / 2 + ",-" + servos.ShootingRange.Height / 2 + ")";
     PosIncTextBox.Text = positionIncrement.ToString();
     //Packet packet = new Packet(servos.CenterServosPosition);
     //packet.setFireOff();
     //this.sendData(packet);
 }
Пример #3
0
        private void transmitPosition()
        {
            int x = int.Parse(XTextBox.Text);
            int y = int.Parse(YTextBox.Text);

            servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
            XTextBox.Text         = servos.GetMathPosition().X.ToString();
            YTextBox.Text         = servos.GetMathPosition().Y.ToString();
            redDot.Location       = servos.GetPorportionalMathPosition(gridBox.Bounds);
            redDot.Location       = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
            Packet packet = new Packet(servos.ServosPosition);

            if (fireOK == true)
            {
                packet.setFireOn();
            }
            else
            {
                packet.setFireOff();
            }
            this.sendData(packet);
        }