public void ShiftUp() { if (Oi.ShifterGear != Gear.High) { Shifter.Set(DoubleSolenoid.Value.Forward); Oi.ShifterGear = Gear.High; } }
/// <summary> /// Sets the DoubleSolenoid to its default position /// </summary> public void DefaultSet() { #if USE_LOCKING lock (solenoid) #endif { solenoid.Set(Default); } }
public void TestDoubleSolenoid() { using (DoubleSolenoid solenoid = new DoubleSolenoid(0, 1)) { NotifyCallback solenoid1Callback = null; NotifyCallback solenoid2Callback = null; int callback1Id = -1; int callback2Id = -1; if (RobotBase.IsSimulation) { solenoid1Callback = (s, o) => { SimData.DIO[12].SetValue(!o.GetBoolean()); }; callback1Id = SimData.PCM[0].RegisterSolenoidOutputCallback(0, solenoid1Callback); solenoid2Callback = (s, o) => { SimData.DIO[13].SetValue(!o.GetBoolean()); }; callback2Id = SimData.PCM[0].RegisterSolenoidOutputCallback(1, solenoid2Callback); } solenoid.Set(DoubleSolenoid.Value.Off); Timer.Delay(SolenoidDelayTime); Assert.That(fakeSolenoid1.Get()); Assert.That(fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Off)); solenoid.Set(DoubleSolenoid.Value.Forward); Timer.Delay(SolenoidDelayTime); Assert.That(!fakeSolenoid1.Get()); Assert.That(fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Forward)); solenoid.Set(DoubleSolenoid.Value.Reverse); Timer.Delay(SolenoidDelayTime); Assert.That(fakeSolenoid1.Get()); Assert.That(!fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Reverse)); if (RobotBase.IsSimulation) { SimData.PCM[0].CancelSolenoidOutputCallback(0, callback1Id); SimData.PCM[0].CancelSolenoidOutputCallback(1, callback2Id); } } }
public void TestSolenoidSetOff() { using (DoubleSolenoid ds = NewDoubleSolenoid()) { ds.Set(DoubleSolenoid.Value.Off); Assert.IsFalse(GetSolenoids().GetSolenoidOutput(1)); Assert.IsFalse(GetSolenoids().GetSolenoidOutput(0)); } }
public void TestSolenoidSetReverse() { using (DoubleSolenoid ds = NewDoubleSolenoid()) { ds.Set(DoubleSolenoid.Value.Reverse); Assert.IsTrue(GetSolenoids().GetSolenoidOutput(1)); Assert.IsFalse(GetSolenoids().GetSolenoidOutput(0)); } }
/// <summary> /// Constructor /// </summary> /// <param name="commonName">CommonName the DoubleSolenoid will have</param> /// <param name="forwardChannel">The forward channel number on the PCM [0..7]</param> /// <param name="reverseChannel">The reverse channel number on the PCM [0..7]</param> /// <param name="_default">Default position for when the Robot is initialized</param> /// <param name="reversed">If the output is reversed for the forward and reversed states</param> public DoubleSolenoidItem(string commonName, int forwardChannel, int reverseChannel, DoubleSolenoid.Value _default, bool reversed = false) { solenoid = new DoubleSolenoid(forwardChannel, reverseChannel); Name = commonName; Default = _default; IsReversed = reversed; solenoid.Set(_default); }
public void TestValueChanged() { using (DoubleSolenoid s = NewDoubleSolenoid()) { s.Set(DoubleSolenoid.Value.Forward); Assert.That(s.Get(), Is.EqualTo(Value.Forward)); s.ValueChanged(null, null, NetworkTables.Value.MakeString("Reverse"), NetworkTables.NotifyFlags.NotifyLocal); Assert.That(s.Get, Is.EqualTo(Value.Reverse)); s.ValueChanged(null, null, NetworkTables.Value.MakeString("Garbage"), NetworkTables.NotifyFlags.NotifyLocal); Assert.That(s.Get, Is.EqualTo(Value.Off)); s.ValueChanged(null, null, NetworkTables.Value.MakeString("Forward"), NetworkTables.NotifyFlags.NotifyLocal); Assert.That(s.Get, Is.EqualTo(Value.Forward)); } }
private void StepTwo() { GearMech.Set(DoubleSolenoid.Value.Forward); }
private void StepOne() { GearClamp.Set(DoubleSolenoid.Value.Reverse); }
public void Open() => manipulatorSolenoid.Set(DoubleSolenoid.Value.Forward);
public void TestDoubleSolenoid() { using (DoubleSolenoid solenoid = new DoubleSolenoid(0, 1)) { Action<string, dynamic> solenoid1Callback = null; Action<string, dynamic> solenoid2Callback = null; if (RobotBase.IsSimulation) { solenoid1Callback = (s, o) => { SimData.DIO[12].Value = !o; }; SimData.GetPCM(0).Solenoids[0].Register("Value", solenoid1Callback); solenoid2Callback = (s, o) => { SimData.DIO[13].Value = !o; }; SimData.GetPCM(0).Solenoids[1].Register("Value", solenoid2Callback); } solenoid.Set(DoubleSolenoid.Value.Off); Timer.Delay(SolenoidDelayTime); Assert.That(fakeSolenoid1.Get()); Assert.That(fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Off)); solenoid.Set(DoubleSolenoid.Value.Forward); Timer.Delay(SolenoidDelayTime); Assert.That(!fakeSolenoid1.Get()); Assert.That(fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Forward)); solenoid.Set(DoubleSolenoid.Value.Reverse); Timer.Delay(SolenoidDelayTime); Assert.That(fakeSolenoid1.Get()); Assert.That(!fakeSolenoid2.Get()); Assert.That(solenoid.Get(), Is.EqualTo(DoubleSolenoid.Value.Reverse)); if (RobotBase.IsSimulation) { SimData.GetPCM(0).Solenoids[0].Cancel("Value", solenoid1Callback); SimData.GetPCM(0).Solenoids[1].Cancel("Value", solenoid2Callback); } } }