Example #1
0
 public void LoadSequenceFile(string fileName)
 {
     sequenceList.LoadFromXml(fileName);
 }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ServoManager servoManager = new ServoManager();

            servoManager.AddServo(new Servo(1));
            servoManager.AddServo(new Servo(2));
            servoManager.AddServo(new Servo(3));

            servoManager.GenerateExampleConfigFile("ExampleConfig.xml");

            SequenceProcessor sequenceProcessor = new SequenceProcessor(servoManager);

            // Create test sequence 1.
            Sequence testSequence = new Sequence("Sequence 1");

            Frame frame1 = new Frame("Frame 1");

            frame1.AddServoPosition(new ServoPosition(1, 100));
            frame1.AddServoPosition(new ServoPosition(2, 200));
            frame1.AddServoPosition(new ServoPosition(3, 300));

            Frame frame2 = new Frame("Frame 2");

            frame2.AddServoPosition(new ServoPosition(1, 400));
            frame2.AddServoPosition(new ServoPosition(2, 500));
            frame2.AddServoPosition(new ServoPosition(3, 600));

            testSequence.AddFrame(frame1);
            testSequence.AddFrame(frame2);

            // Create test sequence 2.
            Sequence testSequence2 = new Sequence("Sequence 2");

            Frame frame3 = new Frame("Frame 3");

            frame3.AddServoPosition(new ServoPosition(1, 900));
            frame3.AddServoPosition(new ServoPosition(2, 800));
            frame3.AddServoPosition(new ServoPosition(3, 700));

            Frame frame4 = new Frame("Frame 4");

            frame4.AddServoPosition(new ServoPosition(1, 600));
            frame4.AddServoPosition(new ServoPosition(2, 500));
            frame4.AddServoPosition(new ServoPosition(3, 400));

            testSequence2.AddFrame(frame3);
            testSequence2.AddFrame(frame4);

            SequenceList sequenceList = new SequenceList();

            sequenceList.AddSequence(testSequence);
            sequenceList.AddSequence(testSequence2);

            sequenceList.SaveToXml("SequenceList.xml");


            SequenceList sequenceList2 = new SequenceList();

            sequenceList2.LoadFromXml("SequenceList.xml");

            //sequenceProcessor.RunSequence(testSequence);
        }