Ejemplo n.º 1
0
        public static void CorvusManagerTestPos()
        {
            CorvusManager corman = new CorvusManager("COM6", 57600);

            Console.WriteLine("Getting position...");
            String s = null;

            if (corman.pos(ref s))
            {
                Console.WriteLine("Position successfully read: " + s);
            }
            else
            {
                Console.WriteLine("Impossible to read position.");
            }

            Console.WriteLine("Moving Origin to point 3, 2, -1.5");

            if (corman.setpos(3, 2, (float)1.5))
            {
                Console.WriteLine("Origin Successfully moved!");
            }
            else
            {
                Console.WriteLine("Faled to move origin!");
            }

            Console.WriteLine("Getting new position.");
            if (corman.pos(ref s))
            {
                Console.WriteLine("New position is " + s);
            }
            else
            {
                Console.WriteLine("Impossible to read new position.");
            }

            Console.WriteLine("Moving to origin");
            if (!corman.move(0, 0, 0))
            {
                Console.WriteLine("Impossible to move to origin");
            }

            corman.Close();
        }
Ejemplo n.º 2
0
        // ----------------------------------------------------------------------


        // Set origin -----------------------------------------------------------
        public void SetOriginButton_Click(object sender, EventArgs ea)
        {
            // check whether port is open
            if (!IsCMSet)
            {
                MessageBox.Show(
                    "Not Connected to Corvus Platform through serial port",
                    "No port connection error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return;
            }

            // get origin coordinates from user input
            float x = (float)this.OriginX.Value;
            float y = (float)this.OriginY.Value;
            float z = (float)this.OriginZ.Value;

            // send position to Corvus platform
            CM.setpos(x, y, z);
            this.updateCorvusConnectionStatus();
        }