Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void GetBumperState()
        {
            var command = new byte[1];

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

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

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

            command[0] = GetOdometryCode;

            manager.CommandAsync(command, 4, this);
        }
Exemplo n.º 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);
        }