def testDualServoMargin(self): control_limits = flap_limits.FlapsToServos( flap_limits.GetControlLimits()) servo_limits = flap_limits.GetAvionicsServoLimits() half_degree = math.radians(0.5) # Shrink servo limits by half a degree on each side. for servo in ['E1', 'E2', 'R1', 'R2']: servo_limits[servo] = (servo_limits[servo][0] + half_degree, servo_limits[servo][1] - half_degree) self._AssertLimitsContain(servo_limits, control_limits)
def testFlapsServosConversion(self): all_servo_limits = flap_limits.GetServoLimits() all_flap_limits = flap_limits.GetFlapLimits() for servo, flap in zip(all_servo_limits, all_flap_limits): # Verify names match. self.assertEqual(servo[0], flap[0]) self._AssertLimitsEqual(servo[1], flap_limits.FlapsToServos(flap[1])) self._AssertLimitsEqual(flap_limits.ServosToFlaps(servo[1]), flap[1])
def __init__(self, mode, **widget_kwargs): super(StarboardPosChart, self).__init__(mode, 'Star Ail Pos [°]', ['A5', 'A7', 'A8'], show_cmd=True, **widget_kwargs) self._SetLimits( { self._ObservationLabel(n): (check_range.Interval(numpy.rad2deg( flap_limits.FlapsToServos( flap_limits.GetControlCrosswindLimits())[n]).tolist(), inclusiveness=(False, False)), check_range.AllInclusiveRange()) for n in ['A7', 'A8'] }, [ control_types.kFlightModeCrosswindNormal, control_types.kFlightModeCrosswindPrepTransOut ])
def __init__(self, mode, **widget_kwargs): nodes = ['E1', 'E2'] super(ElePosChart, self).__init__(mode, 'Ele Pos [°]', nodes, show_cmd=True, **widget_kwargs) limits = flap_limits.FlapsToServos( flap_limits.GetControlCrosswindLimits())['E1'] limits = numpy.rad2deg(limits).tolist() self._SetLimits( { self._ObservationLabel(n): (check_range.Interval(limits, inclusiveness=(False, False)), check_range.AllInclusiveRange()) for n in nodes }, [ control_types.kFlightModeCrosswindNormal, control_types.kFlightModeCrosswindPrepTransOut ])
def testControlLimitsInsideSimLimits(self): self._AssertLimitsContain( flap_limits.GetSimLimits(), flap_limits.FlapsToServos(flap_limits.GetControlLimits()))