Esempio n. 1
0
        // Done!
        #region .Ctor

        // Done!
        internal HardwareHistoryItem(HardwareHistoryType actionType, HardwareActionStatus actionStatus, HardwareStatus status, float degrees, float speed, Vector heading)
        {
            this.ActionType   = actionType;
            this.ActionStatus = actionStatus;
            this.Status       = status;
            this.Degrees      = degrees;
            this.Speed        = speed;
            this.Heading      = heading;
        }
Esempio n. 2
0
        // Done!
        #region Implementation of IHardwareAgent

        // Done!
        public HardwareActionStatus Rotate(float radians, float speed)
        {
            var prediction = this.PredictRotation(radians, speed, this.agent.Status.Batery);
            var real       = this.agent.Rotate(radians, speed);

            if (HardwareActionStatus.CompareOnPrediction(prediction, real) == false)
            {
                //this.rotationNetwork.Train(prediction, real);
            }
            return(real);
        }
Esempio n. 3
0
        // Done!
        public HardwareActionStatus Move(Vector heading, float speed)
        {
            if (isConnected == false)
            {
                return(new HardwareActionStatus(
                           TimeSpan.FromSeconds(0),
                           new FuzzyBool(0),
                           "Failure: Not Connected"));
            }

            var d            = Vector.Distance(this.position, heading);
            var actionStatus = new HardwareActionStatus(
                TimeSpan.FromSeconds(d * speed),
                new FuzzyBool(g.NextSingle(80, 100)),
                "Sucess");

            this.History.AddMove(this, actionStatus, heading, speed);
            this.position += heading;
            return(actionStatus);
        }
Esempio n. 4
0
        // Done!
        #region Implementation of IHardwareAgent

        // Done!
        public HardwareActionStatus Rotate(float radians, float speed)
        {
            if (isConnected == false)
            {
                return(new HardwareActionStatus(
                           TimeSpan.FromSeconds(0),
                           new FuzzyBool(0),
                           "Failure: Not Connected"));
            }

            float t            = (float)(5 / (System.Math.PI / 2f) * radians);
            var   actionStatus = new HardwareActionStatus(
                TimeSpan.FromSeconds(t),
                new FuzzyBool(g.NextSingle(80, 100)),
                "Sucess");

            this.History.AddRotation(this, actionStatus, radians, speed);
            this.angle = Functions.Angle(this.angle + radians);
            return(actionStatus);
        }
Esempio n. 5
0
 // Done!
 public void AddMove(IHardwareAgent agent, HardwareActionStatus actionStatus, Vector heading, float speed)
 {
     this.Add(new HardwareHistoryItem(HardwareHistoryType.Rotate, actionStatus, Helpers.Clone(agent.Status), 0, speed, heading));
 }
Esempio n. 6
0
        // Done!
        #region Methods

        // Done!
        public void AddRotation(IHardwareAgent agent, HardwareActionStatus actionStatus, float angle, float speed)
        {
            this.Add(new HardwareHistoryItem(HardwareHistoryType.Rotate, actionStatus, Helpers.Clone(agent.Status), angle, speed, null));
        }