Esempio n. 1
0
 public SequenceProcessor(ServoManager servoManager, AriaManager ariaManager, RobotSpeech robotSpeech, RobotEyes robotEyes, string sequenceFileName)
 {
     this.servoManager = servoManager;
     this.ariaManager  = ariaManager;
     this.robotSpeech  = robotSpeech;
     this.robotEyes    = robotEyes;
     sequenceList      = new SequenceList(sequenceFileName);
 }
        private void GenerateExampleXmls_Click(object sender, RoutedEventArgs e)
        {
            // Generate example sequence file.

            Frame exampleFrame1 = new Frame("Example Frame 1");
            Frame exampleFrame2 = new Frame("Example Frame 2");

            exampleFrame1.AddServoPosition(new ServoPosition(0, 100));
            exampleFrame1.AddServoPosition(new ServoPosition(1, 500));
            exampleFrame1.timeToDestination = 1;

            exampleFrame2.AddServoPosition(new ServoPosition(0, 200));
            exampleFrame2.AddServoPosition(new ServoPosition(1, 600));
            exampleFrame2.timeToDestination = 0.5;

            Sequence exampleSequence1 = new Sequence("Example Sequence 1");
            Sequence exampleSequence2 = new Sequence("Example Sequence 2");

            exampleSequence1.AddFrame(exampleFrame1);
            exampleSequence1.AddFrame(exampleFrame2);

            exampleSequence2.AddFrame(exampleFrame1);
            exampleSequence2.AddFrame(exampleFrame2);

            SequenceList exampleSequenceList = new SequenceList();

            exampleSequenceList.AddSequence(exampleSequence1);
            exampleSequenceList.AddSequence(exampleSequence2);

            exampleSequenceList.SaveToXml("ExampleSequenceFile.xml");


            // Generate example servo configuration file.

            servoManager.GenerateExampleConfigFile("ExampleServoConfig.xml");
        }
        private void GenerateExampleXmls_Click(object sender, RoutedEventArgs e)
        {
            // Generate example sequence file.

            Frame exampleFrame1 = new Frame("Example Frame 1");
            Frame exampleFrame2 = new Frame("Example Frame 2");

            exampleFrame1.AddServoPosition(new ServoPosition(0, 100));
            exampleFrame1.AddServoPosition(new ServoPosition(1, 500));
            exampleFrame1.timeToDestination = 1;

            exampleFrame2.AddServoPosition(new ServoPosition(0, 200));
            exampleFrame2.AddServoPosition(new ServoPosition(1, 600));
            exampleFrame2.timeToDestination = 0.5;

            Sequence exampleSequence1 = new Sequence("Example Sequence 1");
            Sequence exampleSequence2 = new Sequence("Example Sequence 2");

            exampleSequence1.AddFrame(exampleFrame1);
            exampleSequence1.AddFrame(exampleFrame2);

            exampleSequence2.AddFrame(exampleFrame1);
            exampleSequence2.AddFrame(exampleFrame2);

            SequenceList exampleSequenceList = new SequenceList();
            exampleSequenceList.AddSequence(exampleSequence1);
            exampleSequenceList.AddSequence(exampleSequence2);

            exampleSequenceList.SaveToXml("ExampleSequenceFile.xml");

            // Generate example servo configuration file.

            servoManager.GenerateExampleConfigFile("ExampleServoConfig.xml");
        }
 public SequenceProcessor(ServoManager servoManager, string sequenceFileName)
 {
     this.servoManager = servoManager;
     sequenceList = new SequenceList(sequenceFileName);
 }
        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);
        }
 public SequenceProcessor(ServoManager servoManager, string sequenceFileName)
 {
     this.servoManager = servoManager;
     sequenceList      = new SequenceList(sequenceFileName);
 }