/// <summary> /// These ETA functions are used to calculate the estimated time a movement should take, and in turn sent back to the mobile app in order to display a progress bar. /// </summary> /// <param name="targetOrientation"></param> /// <returns></returns> public int AbsoluteMovementETA(Orientation targetOrientation) { // distance is degrees to steps for az/el // time is in milliseconds int EL_Speed = ConversionHelper.DPSToSPS(ConversionHelper.RPMToDPS(0.6), MotorConstants.GEARING_RATIO_ELEVATION); int AZ_Speed = ConversionHelper.DPSToSPS(ConversionHelper.RPMToDPS(0.6), MotorConstants.GEARING_RATIO_AZIMUTH); Orientation currentOrientation = rtController.GetCurrentOrientation(); int positionTranslationAZ = ConversionHelper.DegreesToSteps(targetOrientation.Azimuth - currentOrientation.Azimuth, MotorConstants.GEARING_RATIO_AZIMUTH); int positionTranslationEL = ConversionHelper.DegreesToSteps((targetOrientation.Elevation - currentOrientation.Elevation), MotorConstants.GEARING_RATIO_ELEVATION); int timeToMoveEl = MCUManager.EstimateMovementTime(EL_Speed, positionTranslationEL); int timeToMoveAz = MCUManager.EstimateMovementTime(AZ_Speed, positionTranslationAZ); // return the greater of the two times (we have to wait for longest mvmt) int timeToMove = timeToMoveEl > timeToMoveAz ? timeToMoveEl : timeToMoveAz; return(timeToMove); }