Exemplo n.º 1
0
        private static void CircleMovementWithAbsolutePosition(ICommunication communication, bool debug)
        {
            var panTiltControl = new EneoPanTiltControl(communication, debug);

            panTiltControl.Start();
            panTiltControl.DisableLimit();

            //var random = new Random();

            for (var i = 0; i < 50; i++)
            {
                var positions = CalculatePolygon(i, new PointF(0, 0), 7);
                foreach (var position in positions)
                {
                    panTiltControl.MovePanAbsolute(position.X);
                    panTiltControl.MoveTiltAbsolute(position.Y);
                    Thread.Sleep(40);
                }

                //panTiltControl.PanTiltAbsolute(0, 0);
                //panTiltControl.ComparePosition(new PanTiltPosition(0, 0), 0.5, 20, 200);
            }

            panTiltControl.EnableLimit();
            panTiltControl.Dispose();
        }
Exemplo n.º 2
0
        private static void DriveRandomPositions(ICommunication communication, bool debug)
        {
            var panTiltControl  = new EneoPanTiltControl(communication, debug);
            var positionChecker = new PositionChecker(panTiltControl);

            panTiltControl.Start();

            var random = new Random();

            while (true)
            {
                var panForward  = true;
                var tiltForward = true;

                if (random.Next(0, 2) == 1)
                {
                    panForward = false;
                }

                if (random.Next(0, 2) == 1)
                {
                    tiltForward = false;
                }

                for (var i = 0; i < 1000; i++)
                {
                    var panDegreePerSecond  = random.Next(1, 40);
                    var tiltDegreePerSecond = random.Next(1, 15);

                    if (!panForward)
                    {
                        panDegreePerSecond = -panDegreePerSecond;
                    }

                    if (!tiltForward)
                    {
                        tiltDegreePerSecond = -tiltDegreePerSecond;
                    }

                    panTiltControl.MoveRelative(panDegreePerSecond, tiltDegreePerSecond);

                    Thread.Sleep(40);
                }

                panTiltControl.PanTiltAbsolute(0, 0);
                positionChecker.ComparePosition(new PanTiltPosition(0, 0), 0.5, 20, 200);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var ipAddress = IPAddress.Parse("192.168.184.105");

            using (ICommunication communication = new UdpNetworkCommunication(ipAddress, 4003, 4003))
                using (IPanTiltControl control = new EneoPanTiltControl(communication))
                {
                    control.Start();
                    Thread.Sleep(200);
                    var currentPosition = control.GetPosition();
                    control.Stop();
                }


            //var ipAddress = IPAddress.Parse("192.168.184.105");
            //ICommunication communication = new TcpNetworkCommunication(new IPEndPoint(ipAddress, 4003));
            //var communication = new SerialPortCommunication("COM1");
            //ICommunication communication = new UdpNetworkCommunication(ipAddress, 4003, 4003);

            ////var reader = new FirmwareReader(communication);
            ////reader.Dispose();

            //IPanTiltControl panTiltControl = new EneoPanTiltControl(communication);
            //Thread.Sleep(1000);

            ////panTiltControl.ReinitializePosition();
            ////panTiltControl.ReinitializePosition(); //2x ???? Warum
            ////Console.WriteLine("Press enter for next command");
            ////Console.ReadLine();


            ////DriveRandomPositions(communication, false);
            //CircleMovementWithAbsolutePosition(communication, false);

            //communication.Dispose();
        }