Example #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);
        }
Example #2
0
        public FPSAim(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();
            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 + ")";
            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);
            Cursor.Hide();
            cursorhidden = true;
            CoordinateTimer.Start();

            //Point camwindowcenter = new Point(gridBox.PointToScreen(new Point(0, 0)).X , gridBox.PointToScreen(new Point(0, 0)).Y );
            //Cursor.Position = camwindowcenter;
            currentX = Cursor.Position.X;
            currentY = Cursor.Position.Y;
            lastX    = 0;
            lastY    = 0;
        }
Example #3
0
        private void remoteAim()
        {
            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);
        }
Example #4
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);
 }
Example #5
0
        private void centerButton_Click(object sender, EventArgs e)
        {
            int x = 0;
            int y = 0;

            lastX = 0;
            lastY = 0;
            servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
            redDot.Location       = servos.GetPorportionalMathPosition(gridBox.Bounds);
            redDot.Location       = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
            textBoxXCoord.Text    = servos.CenterServosPosition.X.ToString();
            textBoxYCoord.Text    = servos.CenterServosPosition.Y.ToString();
            Packet packet = new Packet(servos.CenterServosPosition);

            packet.setFireOff();
            this.sendData(packet);
        }