/** * <summary> * Set the Angle Map by setting a Pulse Width Map given a struct of Pulse Width Constants * </summary> * <param name="PulseWidthMap">Map of roboticangles to pulse widths</param> * <param name="pwc">Pulse Width Constant for pulse width translation</param> */ public void SetPulseWidthMap(Dictionary<RoboticAngle, ulong> PulseWidthMap, PulseWidthConstants pwc) { AngleMap.Clear(); foreach (KeyValuePair<RoboticAngle, ulong>pw in PulseWidthMap) { AngleMap[pw.Key] = pwc.PulseWidthToAngle(pw.Value); } }
/** * <summary> * Translate the Angle Map to a pulse width map given a struct of Pulse Width Constants * </summary> * <param name="pwc">Pulse Width Constant for pulse width translation</param> * <returns>Pulse Width Dictionary Map</returns> */ public Dictionary<RoboticAngle, ulong> GetPulseWidthMap(PulseWidthConstants pwc) { Dictionary<RoboticAngle, ulong> PulseWidthMap = new Dictionary<RoboticAngle, ulong>(); foreach (KeyValuePair<RoboticAngle, double> angle in AngleMap) { PulseWidthMap[angle.Key] = pwc.AngleToPulseWidth(angle.Value); } return PulseWidthMap; }