/// <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); }
/// <summary> /// Calls the method to set the value to the solenoid /// </summary> /// <param name="value">The enum variable to set the solenoid to</param> /// <param name="sender">the caller of this method</param> public void Set(DoubleSolenoid.Value value, object sender) { Sender = sender; #if USE_LOCKING lock (solenoid) #endif { solenoid.Set(value); } Sender = null; }
/// <summary> /// shifts Da hood /// </summary> /// <param name="value"></param> /// <param name="sender"></param> public void ShiftHood(DoubleSolenoid.Value value, object sender) { var tmp = (DoubleSolenoidItem)(config.ActiveCollection.Get(hood)); tmp.Set(value, sender); }
/// <summary> /// sets gm rampy thingy /// </summary> /// <param name="value"></param> /// <param name="sender"></param> public void SetRamp(DoubleSolenoid.Value value, object sender) { var tmp = (DoubleSolenoidItem)(config.ActiveCollection.Get(gmRamp)); tmp.Set(value, sender); }
/// <summary> /// shift into high/low gear forward=high /// </summary> /// <param name="value"></param> /// <param name="sender"></param> public void ShiftGears(DoubleSolenoid.Value value, object sender) { var tmp = (DoubleSolenoidItem)(config.ActiveCollection.Get(dt_shifter)); tmp.Set(value, sender); }
/// <summary> /// Zeros all motor set values, including the Teleop Set, and autonomous ExtSet /// </summary> private void Zero() { _fstate = FireingState.ReadyToFire; _wheelSet = 0; _elevatorSet = 0; _triggerSet = DoubleSolenoid.Value.Off; WheelExtSet = 0; ElevatorExtSet = 0; TriggerExtSet = DoubleSolenoid.Value.Off; }
/// <summary> /// Reads controller input we can make different methods based on different times and places and to save previous attemps /// </summary> private void ReadController() { //Controls the main spining wheels if(Math.Abs(_wheelSet) < .0005) { if (xbox.GetRightBumper()) _wheelSet += .001; } else if( Math.Abs(_wheelSet - 1) < .005) { if (xbox.GetLeftBumper()) _wheelSet -= 0.001; } else { if (xbox.GetLeftBumper()) _wheelSet -= 0.001; if (xbox.GetRightBumper()) _wheelSet += .001; } switch (_fstate) { case FireingState.ReadyToFire: SmartWriter.WriteString("Frisbee Fireing State", "Ready To Fire", DebugMode.Competition); if (xbox.GetRightTrigger() > .5) { _t = new Timer(); _t.Start(); _triggerSet = DoubleSolenoid.Value.Forward; _fstate = FireingState.Fireing; } break; case FireingState.Fireing: SmartWriter.WriteString("Frisbee Fireing State", "Fireing", DebugMode.Competition); if (_t.Get() > 1) { _t.Reset(); _fstate = FireingState.Reloading; } break; case FireingState.Reloading: SmartWriter.WriteString("Frisbee Fireing State", "Reloading", DebugMode.Competition); if (_t.Get() > 2) { _t = null; _fstate = FireingState.ReadyToFire; } break; } }