예제 #1
0
        public void Actuate()
        {
            var leftWeight = (Math.Abs(currentVelocity.LeftVelocity) - Math.Abs(previousVelocity.LeftVelocity) > 0) ? accelerationWeight : breakingWeight;

            if (Math.Sign(currentVelocity.LeftVelocity) != Math.Sign(previousVelocity.LeftVelocity))
            {
                leftWeight = breakingWeight;
            }
            if (previousVelocity.LeftVelocity == 0)
            {
                leftWeight = accelerationWeight;
            }
            var rightWeight = (Math.Abs(currentVelocity.RightVelocity) - Math.Abs(previousVelocity.RightVelocity) > 0) ? accelerationWeight : breakingWeight;

            if (Math.Sign(currentVelocity.RightVelocity) != Math.Sign(previousVelocity.RightVelocity))
            {
                rightWeight = breakingWeight;
            }
            if (previousVelocity.RightVelocity == 0)
            {
                rightWeight = accelerationWeight;
            }

            var left  = previousVelocity.LeftVelocity + (leftWeight * (currentVelocity.LeftVelocity - previousVelocity.LeftVelocity));
            var right = previousVelocity.RightVelocity + (rightWeight * (currentVelocity.RightVelocity - previousVelocity.RightVelocity));

            previousVelocity = new WheelVelocity(left, right);
            var command = ParseUpdateWheelVelocity(previousVelocity, SetWheelVelocityCode, WheelClicks);

            manager.CommandAsync(command, 0, this);
        }
예제 #2
0
        public void GetBumperState()
        {
            var command = new byte[1];

            command[0] = GetBumperStateCode;
            manager.CommandAsync(command, 2, this);
        }
예제 #3
0
        public void GetGroundSensorState()
        {
            var command = new byte[1];

            command[0] = GetGroundSensorStateCode;
            manager.CommandAsync(command, 6, this);
        }
예제 #4
0
        public void GetSonarsBoardState()
        {
            var command = new byte[1];

            command[0] = GetSonarsStateCode;
            manager.CommandAsync(command, 10, this);
        }
예제 #5
0
        public void UpdateOdometryCommand()
        {
            var command = new byte[1];

            command[0] = GetOdometryCode;

            manager.CommandAsync(command, 4, this);
        }
예제 #6
0
        public void Actuate()
        {
            var command = new byte[4];

            command[0] = GetLedBoardStateCode;
            command[1] = red;
            command[2] = green;
            command[3] = blue;
            manager.CommandAsync(command, 0, this);
        }