예제 #1
0
        public NeutralMovement(MotionProxy motionproxy, object LockMotion, MovingSettings ms,
            LedsProxy ledsproxy, object LockLeds)
        {
            setting = ms;

            ALMotion = motionproxy;
            this.LockMotion = LockMotion;
            ALLeds = ledsproxy;
            this.LockLeds = LockLeds;

            mItems = setting.WhatToMove;
        }
 public static MovingSettings Load(string filename)
 {
     //string filename = ModelDirectory + subjectname + ".BasicData.xml";
     if (File.Exists(filename) == true)
     {
         using (StreamReader sr = new StreamReader(filename, Encoding.UTF8))
         {
             XmlSerializer xs = new XmlSerializer(typeof(MovingSettings));
             return (MovingSettings)xs.Deserialize(sr.BaseStream);
         }
     }
     else
     {
         Debug.WriteLine("Can't find " + filename + ". Use defaults instead");
         MovingSettings current = new MovingSettings();
         return current;
     }
 }
예제 #3
0
        void InitIdleMovement()
        {
            if (IdleMovement == null)
            {
                IdleMovementSettings = MovingSettings.Load("../../ConnectorNao/MovingSettings.xml");

                // set defaults
                if (IdleMovementSettings.BlinkEyesTimes.MinTime < 100) IdleMovementSettings.BlinkEyesTimes.MinTime = 2000;
                if (IdleMovementSettings.BlinkEyesTimes.MaxTime < 100) IdleMovementSettings.BlinkEyesTimes.MaxTime = 5000;
                if (IdleMovementSettings.MoveArmsTimes.MinTime < 100) IdleMovementSettings.MoveArmsTimes.MinTime = 750;
                if (IdleMovementSettings.MoveArmsTimes.MaxTime < 100) IdleMovementSettings.MoveArmsTimes.MaxTime = 1500;
                if (IdleMovementSettings.MoveHeadTimes.MinTime < 100) IdleMovementSettings.MoveHeadTimes.MinTime = 500;
                if (IdleMovementSettings.MoveHeadTimes.MaxTime < 100) IdleMovementSettings.MoveHeadTimes.MaxTime = 1500;
                if (IdleMovementSettings.MoveHandsTimes.MinTime < 100) IdleMovementSettings.MoveHandsTimes.MinTime = 1000;
                if (IdleMovementSettings.MoveHandsTimes.MaxTime < 100) IdleMovementSettings.MoveHandsTimes.MaxTime = 2500;
                if (IdleMovementSettings.MoveHipsTimes.MinTime < 100) IdleMovementSettings.MoveHipsTimes.MinTime = 500;
                if (IdleMovementSettings.MoveHipsTimes.MaxTime < 100) IdleMovementSettings.MoveHipsTimes.MaxTime = 1000;
                if (IdleMovementSettings.RandomEyesTimes.MinTime < 100) IdleMovementSettings.RandomEyesTimes.MinTime = 500;
                if (IdleMovementSettings.RandomEyesTimes.MaxTime < 100) IdleMovementSettings.RandomEyesTimes.MaxTime = 1000;

                IdleMovement = new NeutralMovement(this.proxyMotion, this.lockMotion, IdleMovementSettings, this.proxyLed, this.lockLed);
                IdleMovement.NeutralStopped += new EventHandler(IdleMovementStopped);
                IdleMovement.NeutralPaused += new EventHandler(IdleMovementPaused);
            }
        }