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(); }
// must be run as thread protected void ReadSerial() { while (true) { __readSerialEvent.WaitOne(); // assume that CM has been correctly initialized if (!CM.pos(ref position)) { // handle error } __bufferReadyCountdown.Signal(); } }