コード例 #1
0
        public OutputToWheels Add(MotorPolarity leftMotorPolarity, MotorPolarity rightMotorPolarity, uint leftMotorTachocount, uint rightMotorTachocount)
        {
            var m = new OutputToWheels(leftMotorPolarity, rightMotorPolarity, leftMotorTachocount, rightMotorTachocount);

            _motorOutputs.Add(m);
            return(m);
        }
コード例 #2
0
ファイル: OutputToWheels.cs プロジェクト: TejBirring8/AVINSoR
 /// <summary>
 ///
 /// </summary>
 /// <param name="leftMotorPower"></param>
 /// <param name="rightMotorPower"></param>
 /// <param name="leftMotorTachocount"></param>
 /// <param name="rightMotorTachocount"></param>
 public OutputToWheels(MotorPolarity leftMotorPolarity, MotorPolarity rightMotorPolarity, uint leftMotorTachocount, uint rightMotorTachocount)
 {
     DelayInSeconds       = 0;
     RightMotorTachocount = rightMotorTachocount;
     LeftMotorTachocount  = leftMotorTachocount;
     LeftMotorPolarity    = leftMotorPolarity;
     RightMotorPolarity   = rightMotorPolarity;
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="absPower"></param>
        /// <param name="motPolarity"></param>
        /// <returns></returns>
        private sbyte ExtractMotorPower(uint absPower, MotorPolarity motPolarity)
        {
            var forwardPwr = Convert.ToSByte(absPower);
            var reversePwr = Convert.ToSByte(-absPower);

            switch (motPolarity)
            {
            case MotorPolarity.Forward:
                return(forwardPwr);

            case MotorPolarity.Reverse:
                return(reversePwr);

            default:
                return(0);
            }
        }