public OutputToWheels Add(MotorPolarity leftMotorPolarity, MotorPolarity rightMotorPolarity, uint leftMotorTachocount, uint rightMotorTachocount) { var m = new OutputToWheels(leftMotorPolarity, rightMotorPolarity, leftMotorTachocount, rightMotorTachocount); _motorOutputs.Add(m); return(m); }
/// <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; }
/// <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); } }