public void OnServoTimed(ServoComponent servo, float startValue, float endValue, int delayMillis) { ServoCommand command1 = new ServoCommand(servo.BoardID, startValue); ServoCommand command2 = new ServoCommand(servo.BoardID, endValue); _listener.OnTimedCommand(command1, command2, delayMillis); }
public TestStandMapping() { PT_N2 = new PressureComponent(16, "PT_N2", "PT-N2", 400); PT_IPA = new PressureComponent(17, "PT_IPA", "PT-IPA", 50); PT_N2O = new PressureComponent(18, "PT_N2O", "PT-N2O", 50); PT_FUEL = new PressureComponent(19, "PT_FUEL", "PT-FUEL", 50); PT_OX = new PressureComponent(20, "PT_OX", "PT-OX", 50); PT_CHAM = new PressureComponent(21, "PT_CHAM", "PT-CHAM", 50); TC_IPA = new TemperatureComponent(8, "TC_IPA", "TC-IPA", x => x); TC_N2O = new TemperatureComponent(9, "TC_N2O", "TC-N2O", x => x); TC_1 = new TemperatureComponent(10, "TC_1", "TC-1", x => x); TC_2 = new TemperatureComponent(11, "TC_2", "TC-2", x => x); TC_3 = new TemperatureComponent(12, "TC_3", "TC-3", x => x); TC_4 = new TemperatureComponent(13, "TC_4", "TC-4", x => x); TC_5 = new TemperatureComponent(14, "TC_5", "TC-5", x => x); TC_6 = new TemperatureComponent(15, "TC_6", "TC-6", x => x); LOAD = new LoadComponent(0, "LOAD", "Load cell"); SV_IPA = new SolenoidComponent(4, "SV_IPA", "SV-IPA", "SV_IPA_SYMBOL"); SV_N2O = new SolenoidComponent(5, "SV_N2O", "SV-N2O", "SV_N2O_SYMBOL"); MV_IPA = new ServoComponent(6, "MV_IPA", "MV-IPA", "MV_IPA_SYMBOL"); MV_N2O = new ServoComponent(7, "MV_N2O", "MV-N2O", "MV_N2O_SYMBOL"); TARGET_MV_IPA = new SimpleComponent(25, 2, false, "TARGET-MV-IPA", "TARGET-MV-IPA [%]", x => ((float)x) / ushort.MaxValue * 100.0f); TARGET_MV_N2O = new SimpleComponent(26, 2, false, "TARGET-MV-N20", "TARGET-MV-N20 [%]", x => ((float)x) / ushort.MaxValue * 100.0f); SN_N2O_FILL = new SolenoidComponent(2, "SN_N2O_FILL", "SN-N2O-FILL", "SN_N2O_FILL_SYMBOL"); SN_FLUSH = new SolenoidComponent(3, "SN_FLUSH", "SN-FLUSH", "SN_FLUSH_SYMBOL"); BATTERY = new VoltageComponent(22, "BATTERY", "BATTERY", 12.0f, 14.8f); FLO_IPA = new FlowComponent(100, "FLO_IPA", "FLO-IPA", ref PT_FUEL, ref PT_CHAM, () => PreferenceManager.Manager.Preferences.Fluid.Fuel); FLO_N2O = new FlowComponent(101, "FLO_N2O", "FLO-N2O", ref PT_N2O, ref PT_CHAM, () => PreferenceManager.Manager.Preferences.Fluid.Oxid); T_IPA = new TankComponent(24, "FUEL", "FUEL", "FUEL_GRADIENT", ref FLO_IPA, "Fuel"); T_N2O = new LevelComponent(1, "OXID", "OXID", "OXID_GRADIENT", 20); STACK_HEALTH = new StackHealthComponent(23, "STACK_MAIN", "STACK_ACTUATOR", "STACK_SENSOR", "STACK-HEALTH"); _states = new List <State> { new State(0, "Idle"), new State(1, "Ignition"), new State(2, "Pre-Stage 1"), new State(3, "Pre-Stage 2"), new State(4, "Ramp up"), new State(5, "Regulated"), new State(6, "Shutdown 1"), new State(7, "Shutdown 2"), new State(8, "Flush") }; EmergencyState = _states[6]; PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.ChamberPressureID = PT_CHAM.BoardID; PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.FuelLinePressureID = PT_FUEL.BoardID; PreferenceManager.Manager.Preferences.AutoSequenceComponentIDs.OxidizerLinePressureID = PT_OX.BoardID; }
public Beagle() { I2CBus = new I2CBusComponent(); ServoController = new ServoComponent(); MotorController = new MotorControllerComponent(); PowerSupplyController = new PowerSupplyComponent(); BatteryMonitorA = new BatteryMonitorComponent("A", 0x35); BatteryMonitorB = new BatteryMonitorComponent("B", 0x34); IMU = new ImuComponent(); Camera = new CameraComponent(); UltrasonicRangeFinder = new UltrasonicRangeFinderComponent(); }
public void Servo_Component_Is_Updated_Correctly() { byte ID = 6; ServoComponent expectedResult = new ServoComponent(0, "", "", ""); expectedResult.Set(40000); TestStandMapping mapping = new TestStandMapping(); Session session = new Session(mapping); // Value = 1337 = 0x539 session.UpdateComponents(new byte[] { ID, 0x9C, 0x40 }); Assert.AreEqual(expectedResult.Degree(), ((ServoComponent)mapping.ComponentsByID()[ID]).Degree()); }
public void OnServoTimed(ServoComponent servo, float startValue, float endValue, int delayMillis) { _listener.OnServoTimed(servo, startValue, endValue, delayMillis); }
public void OnServoPressed(ServoComponent servo, float value) { _listener.OnServoPressed(servo, value); }
public void OnServoPressed(ServoComponent servo, float value) { ServoCommand command = new ServoCommand(servo.BoardID, value); _listener.OnCommand(command); }
public ServoControlWidget(ServoComponent component, ServoCallback callback, ServoCallbackTimed timedCallback) { Build(); _component = component; _callback = callback; _timedCallback = timedCallback; VisibleWindow = false; AboveChild = false; _openButton = new Button { Label = "Open", HeightRequest = 40 }; _closeButton = new Button { Label = "Close", HeightRequest = 40 }; _setButton = new Button { Label = "Set", HeightRequest = 40 }; _setInput = new Entry { WidthChars = 5, HeightRequest = 40, }; _setTimeButton = new Button { Label = "Set with time", HeightRequest = 40 }; _timeEntry = new Entry { WidthChars = 6, HeightRequest = 40 }; _openButton.Pressed += OpenButton_Pressed; _closeButton.Pressed += CloseButton_Pressed; _setButton.Pressed += SetButton_Pressed; _setTimeButton.Pressed += SetTimeButtonOnPressed; Gdk.Color insensitiveColor = new Gdk.Color(140, 140, 140); _openButton.ModifyBg(StateType.Insensitive, insensitiveColor); _closeButton.ModifyBg(StateType.Insensitive, insensitiveColor); _setButton.ModifyBg(StateType.Insensitive, insensitiveColor); _setInput.ModifyBase(StateType.Insensitive, insensitiveColor); _setTimeButton.ModifyBg(StateType.Insensitive, insensitiveColor); _timeEntry.ModifyBase(StateType.Insensitive, insensitiveColor); HBox controls = new HBox(false, 5); controls.PackStart(_openButton, false, false, 0); controls.PackStart(_closeButton, false, false, 0); controls.PackStart(_setInput, false, false, 0); controls.PackStart(_setButton, false, false, 0); HBox timedControls = new HBox(false, 5); timedControls.PackStart(_timeEntry, false, false, 0); timedControls.PackStart(_setTimeButton, true, true, 0); VBox container = new VBox(false, 5); Label name = new Label() { Text = _component.Name, Xalign = 0.0f, Yalign = 0.0f }; name.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 255)); container.PackStart(name, false, false, 0); container.PackStart(controls, false, false, 0); container.PackStart(timedControls, false, false, 0); Add(container); }