项目:Steamworks2017Robot
文件:DriveTrain.java
/**
* Shifts the gearBoxes up or down.
*
* @param shiftType whether to shift up or down
*/
public void shift(ShiftType shiftType) {
logger.info(String.format("Shifting,type=%s,shifter state=%s",shiftType.toString(),shiftingSolenoid.get().toString()));
if (pcmPresent) {
if (shiftType == ShiftType.TOGGLE) {
if (shiftingSolenoid.get() == DoubleSolenoid.Value.kReverse) {
shiftingSolenoid.set(DoubleSolenoid.Value.kForward);
SmartDashboard.putBoolean("Drive_Shift",true);
} else {
shiftingSolenoid.set(DoubleSolenoid.Value.kReverse);
SmartDashboard.putBoolean("Drive_Shift",false);
}
} else if (shiftType == ShiftType.UP) {
shiftingSolenoid.set(DoubleSolenoid.Value.kForward);
SmartDashboard.putBoolean("Drive_Shift",true);
} else {
shiftingSolenoid.set(DoubleSolenoid.Value.kReverse);
SmartDashboard.putBoolean("Drive_Shift",false);
}
}
}
项目:Steamwork_2017
文件:Robot.java
public Robot() {
stick = new Joystick(0);
driveLeftFront = new Victor(LEFT_FRONT_DRIVE);
driveLeftRear = new Victor(LEFT_REAR_DRIVE);
driveRightFront = new Victor(RIGHT_FRONT_DRIVE);
driveRightRear = new Victor(RIGHT_REAR_DRIVE);
enhancedDriveLeft = new Victor(ENHANCED_LEFT_DRIVE);
enhancedDriveRight = new Victor(ENHANCED_RIGHT_DRIVE);
gearBox = new DoubleSolenoid(GEAR_Box_PART1,GEAR_Box_PART2);
climber1 = new Victor(climBER_PART1);
climber2 = new Victor(climBER_PART2);
vexSensorBackLeft = new Ultrasonic(0,1);
vexSensorBackRight = new Ultrasonic(2,3);
vexSensorFrontLeft = new Ultrasonic(4,5);
vexSensorFrontRight = new Ultrasonic(6,7);
Skylar = new RobotDrive(driveLeftFront,driveLeftRear,driveRightFront,driveRightRear);
OptimusPrime = new RobotDrive(enhancedDriveLeft,enhancedDriveRight);
}
项目:MinuteMan
文件:HardwareAdaptor.java
private HardwareAdaptor(){
pdp = new PowerdistributionPanel();
comp = new Compressor();
shifter = new DoubleSolenoid(SolenoidMap.SHIFTER_FORWARD,SolenoidMap.SHIFTER_REVERSE);
navx = new AHRS(coprocessorMap.NAVX_PORT);
dtLeftEncoder = new Encoder(EncoderMap.DT_LEFT_A,EncoderMap.DT_LEFT_B,EncoderMap.DT_LEFT_INVERTED);
S_DTLeft.linkEncoder(dtLeftEncoder);
dtRightEncoder = new Encoder(EncoderMap.DT_RIGHT_A,EncoderMap.DT_RIGHT_B,EncoderMap.DT_RIGHT_INVERTED);
S_DTRight.linkEncoder(dtRightEncoder);
dtLeft = S_DTLeft.getInstance();
dtRight = S_DTRight.getInstance();
S_DTWhole.linkDTSides(dtLeft,dtRight);
dtWhole = S_DTWhole.getInstance();
arduino = S_Arduino.getInstance();
}
项目:FRC-2017-Public
文件:Spatula.java
@Override
public void update(Commands commands,RobotState robotState) {
switch (commands.wantedSpatulaState) {
case UP:
mOutput = DoubleSolenoid.Value.kReverse;
mState = SpatulaState.UP;
break;
case DOWN:
mOutput = DoubleSolenoid.Value.kForward;
mState = SpatulaState.DOWN;
break;
}
mDv.updateValue(mOutput.toString() == "kReverse" ? "UP" : "DOWN");
DashboardManager.getInstance().publishKVPair(mDv);
}
项目:FRC-2017-Public
文件:FlippersTest.java
@Test
public void testOutput() {
Commands commands = Robot.getCommands();
Flippers flippers = Flippers.getInstance();
Flippers.FlipperSignal desired = new Flippers.FlipperSignal(DoubleSolenoid.Value.kForward,DoubleSolenoid.Value.kForward);
commands.wantedFlipperSignal = desired;
flippers.update(commands,Robot.getRobotState());
assertthat("Spatula not up",flippers.getFlipperSignal(),equalTo(desired));
desired = new Flippers.FlipperSignal(DoubleSolenoid.Value.kForward,DoubleSolenoid.Value.kReverse);
commands.wantedFlipperSignal = desired;
flippers.update(commands,equalTo(desired));
desired = new Flippers.FlipperSignal(DoubleSolenoid.Value.kReverse,equalTo(desired));
}
项目:449-central-repo
文件:ShiftComponent.java
/**
* Default constructor.
*
* @param otherShiftables All objects that should be shifted when this component's piston is.
* @param piston The piston that shifts.
* @param startingGear The gear to start in. Can be null,and if it is,the starting gear is gotten from the
* piston's position.
*/
@JsonCreator
public ShiftComponent(@NotNull @JsonProperty(required = true) List<Shiftable> otherShiftables,@NotNull @JsonProperty(required = true) MappedDoubleSolenoid piston,@Nullable Shiftable.gear startingGear) {
this.otherShiftables = otherShiftables;
this.piston = piston;
if (startingGear != null) {
this.currentGear = startingGear.getNumVal();
} else {
//Get the starting gear from the piston's position if it's not provided
this.currentGear = piston.get() == DoubleSolenoid.Value.kForward ? Shiftable.gear.LOW.getNumVal() : Shiftable.gear.HIGH.getNumVal();
}
//Set all the shiftables to the starting gear.
for (Shiftable shiftable : otherShiftables) {
shiftable.setGear(currentGear);
}
}
项目:GRITS16
文件:Load.java
public static void changeIntakePosition(){
if(CMap.auxJoystick.getTrigger()){
if(!intakeBeenpressed){
if(intakePosition == "up"){
intakePosition = "down";
System.out.println("Intake Position set to " + intakePosition + " at " + CMap.teleopTimer.get() + " seconds.");
} else if(intakePosition == "down"){
intakePosition = "up";
}
}
intakeBeenpressed = true;
} else {
intakeBeenpressed = false;
}
if(intakePosition == "up"){
CMap.intakeSolenoid.set(DoubleSolenoid.Value.kReverse);
} else if(intakePosition == "down"){
CMap.intakeSolenoid.set(DoubleSolenoid.Value.kForward);
}
}
项目:FRC-2014-robot-project
文件:ShooterControl.java
ShooterControl(Encoder encoder,SpeedController pullBackSpeedController,double speedControllerMaxRpm,DigitalInput limitSwitch,DoubleSolenoid gearControl,Servo latchServo,Relay angleControl)
{
m_latchReleaseServo = latchServo;
m_currentState = SHOOTER_CONTROL_STATE_WAIT;
m_encoder = encoder;
m_pullBackSpeedController = pullBackSpeedController;
m_angleControl = angleControl;
m_speedControllerMaxRpm = speedControllerMaxRpm;
m_limitSwitch = limitSwitch;
m_pullBackEncoderRpm = new EncoderRPM();
m_pullBackEncoderRpm.Init(m_pullBackSpeedController,m_encoder,(-1)*m_speedControllerMaxRpm,m_speedControllerMaxRpm,0.05,100,m_limitSwitch);
m_releaseFromMidptEncoderRpm = new EncoderRPM();
m_releaseFromMidptEncoderRpm.Init(m_pullBackSpeedController,(-1)*m_speedControllerMaxRpm/4,3);
m_gearControl = gearControl;
m_latchReleased = false;
m_gearReleased = false;
m_isPulledBack = false;
}
项目:FRC-2014-robot-project
文件:ShooterControl.java
private void HandleStateRelease()
{
if (!m_gearReleased)
{
// set the gear in neutral
m_gearControl.set(DoubleSolenoid.Value.kForward);
m_gearReleased = true;
}
if(!m_latchReleased)
{
//release the latch
m_latchReleaseServo.set(1);
Timer.delay(0.5);
m_latchReleased = true;
}
m_isPulledBack = false;
m_currentState = SHOOTER_CONTROL_STATE_WAIT;
}
项目:Spartonics-Code
文件:Winch.java
public Winch() {
winchMotor = new CANTalon(RobotMap.WINCH_MOTOR);
winchBrake = new DoubleSolenoid(RobotMap.WINCH_STOPPER_CHANNEL_A,RobotMap.WINCH_STOPPER_CHANNEL_B);
this.winchMotor.enableBrakeMode(false);
this.winchMotor.changeControlMode(TalonControlMode.Voltage);
this.putBrakeOff();
}
项目:frc-2017
文件:GearManipulator.java
public void toggleManipulator() {
Value solenoidVal = manipulatorSolenoid.get();
if (solenoidVal == Value.kForward) {
manipulatorSolenoid.set(DoubleSolenoid.Value.kReverse);
} else {
manipulatorSolenoid.set(DoubleSolenoid.Value.kForward);
manipulatorMotor.set(0.5);
}
}
项目:FRC-2017-Command
文件:WinchPush.java
/**
*
* @param value sets the solenoid state
*/
public void setLock(boolean value){
if(value){
sol.set(DoubleSolenoid.Value.kForward);
}else{
sol.set(DoubleSolenoid.Value.kReverse);
}
SmartDashboard.putBoolean("Winch Cylinder",value);
}
项目:2017
文件:CANObject.java
/**
* Creates CAN Pnuematics Control Module object
*
* @param newdoubleSolenoid
* the CAN Pnuematics Control Module associated with this object
* @param newCanId
* the ID of the CAN object
*/
public CANObject (final DoubleSolenoid newdoubleSolenoid,int newCanId)
{
doubleSolenoid = newdoubleSolenoid;
canId = newCanId;
typeId = 3;
// if(useDebug == true)
// {
// System.out.println("The Double Solenoid is " + doubleSolenoid);
// System.out.println("The canId of the DoubleSolenoid is " + canId);
// System.out.println("The type Id of the DoubleSolenoid is " + typeId);
// }
}
项目:2017
文件:CANObject.java
/**
* Checks if the CAN Device is a Pnuematic Control Module
*
* @return Returns Pnuematic Control Module if type ID is 3,if not returns null
*/
public DoubleSolenoid getdoubleSolenoid ()
{
if (typeId == 3)
{
return doubleSolenoid;
}
return null;
}
项目:Robot_2017
文件:RobotMap.java
public static void init() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
compressor = new Compressor();
driveTrainLeftFront = new CANTalon(1);
LiveWindow.addActuator("DriveTrain","LeftFront",driveTrainLeftFront);
driveTrainRightFront = new CANTalon(3);
LiveWindow.addActuator("DriveTrain","RightFront",driveTrainRightFront);
driveTrainLeftRear = new CANTalon(2);
driveTrainLeftRear.changeControlMode(TalonControlMode.Follower);
driveTrainLeftRear.set(driveTrainLeftFront.getdeviceid());
LiveWindow.addActuator("DriveTrain","LeftRear",driveTrainLeftRear);
driveTrainRightRear = new CANTalon(4);
driveTrainRightRear.changeControlMode(TalonControlMode.Follower);
driveTrainRightRear.set(driveTrainRightFront.getdeviceid());
driveTrainRightRear.reverSEOutput(false);
LiveWindow.addActuator("DriveTrain","RightRear",driveTrainRightRear);
driveTrainLeftFront.setInverted(true);
driveTrainRightFront.setInverted(true);
driveTrainLeftRear.setInverted(true);
driveTrainRightRear.setInverted(true);
driveTrainRobotDrive41 = new RobotDrive(driveTrainRightFront,driveTrainLeftFront);
driveTrainRobotDrive41.setSafetyEnabled(true);
driveTrainRobotDrive41.setExpiration(0.1);
driveTrainRobotDrive41.setSensitivity(0.5);
driveTrainRobotDrive41.setMaxOutput(1.0);
climbMotor = new CANTalon(5);
LiveWindow.addActuator("climbing","Motor",climbMotor);
lightsLightEnable = new Relay(0);
LiveWindow.addActuator("Lights","LightEnable",lightsLightEnable);
gearIntakeRamp = new DoubleSolenoid(1,0);
LiveWindow.addActuator("GearIntake","IntakeRamp",gearIntakeRamp);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Robot_2017
文件:Robot.java
public void teleopInit() {
DriveEncoders.intializeEncoders();
Gearscore.gearscoreDoor.set(DoubleSolenoid.Value.kForward);
setBrakeMode(true);
InterfaceFlip.isFlipped = false;
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command,remove
// this line or comment it out.
if (autonomousCommand != null) autonomousCommand.cancel();
}
public void setHighGear(boolean enabled) {
_isGearOn = enabled;
_gearShifter1.set(enabled ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse);
_gearShifter2.set(enabled ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse);
// _gearShifter3.set(enabled ? DoubleSolenoid.Value.kForward
// : DoubleSolenoid.Value.kReverse);
}
项目:Steamworks2017Robot
文件:DriveTrain.java
项目:MinuteMan
文件:S_DTWhole.java
/**
* Toggle current drive gear
*
* @param gear Gear to shift to
*/
public static void shift(SubsystemStates.DriveGear gear) {
switch (gear) {
case LOW:
Robot.adaptor.shifter.set(DoubleSolenoid.Value.kForward);
SubsystemStates.driveGear = SubsystemStates.DriveGear.LOW;
break;
case HIGH:
Robot.adaptor.shifter.set(DoubleSolenoid.Value.kReverse);
SubsystemStates.driveGear = SubsystemStates.DriveGear.HIGH;
break;
}
}
项目:BBLIB
文件:bbDoubleSolenoid.java
public void toggle()
{
if (get() == DoubleSolenoid.Value.kOff)
{
defaultPosition(isTrigger);
}
else if (get() == DoubleSolenoid.Value.kReverse)
{
forward();
}
else if (get() == DoubleSolenoid.Value.kForward)
{
reverse();
}
}
项目:2016-Robot-Final
文件:Shooter.java
项目:2016-Robot-Final
文件:Shooter.java
public void setSol(int direction) {
if (direction == 1) {
solenoid.set(DoubleSolenoid.Value.kForward);
} else if (direction == 0) {
solenoid.set(DoubleSolenoid.Value.kOff);
} else if (direction == -1) {
solenoid.set(DoubleSolenoid.Value.kReverse);
}
}
项目:2016-Robot-Final
文件:Drive.java
/**
* Set the solenoid forward or reverse.
*
* @param direction
* the direction to set the solenoid,in 1 or -1. 1 will set to
* high gear,-1 to low gear.
*/
public void setSol(int direction) {
if (direction == -1) {
// Set drive in low gear
solenoid.set(DoubleSolenoid.Value.kReverse);
setGear(0);
} else if (direction == 1) {
// Set drive in high gear
solenoid.set(DoubleSolenoid.Value.kForward);
setGear(1);
} else {
return;
}
}
项目:449-central-repo
文件:ToggleSolenoid.java
项目:449-central-repo
文件:ShiftComponent.java
/**
* Shifts the piston to the given gear.
*
* @param gear The gear to shift to
*/
protected void shiftPiston(int gear) {
if (gear == Shiftable.gear.LOW.getNumVal()) {
//Switch to the low gear pos
piston.set(DoubleSolenoid.Value.kForward);
} else {
//If we want to switch to high gear and the low gear pos is reverse,switch to forward
piston.set(DoubleSolenoid.Value.kReverse);
}
}
项目:frc-2016
文件:AManipulators.java
public void toggleAManipulators() {
Value solenoidVal = aManipulatorSolenoid.get();
if (solenoidVal == Value.kReverse) {
aManipulatorSolenoid.set(DoubleSolenoid.Value.kForward);
} else {
aManipulatorSolenoid.set(DoubleSolenoid.Value.kReverse);
}
}
项目:frc-2016
文件:Intake.java
项目:RobotBuilderTest
文件:RobotMap.java
public static void init() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrainLeftMotor = new Talon(0);
LiveWindow.addActuator("DriveTrain","LeftMotor",(Talon) driveTrainLeftMotor);
driveTrainRightMotor = new Talon(1);
LiveWindow.addActuator("DriveTrain","RightMotor",(Talon) driveTrainRightMotor);
driveTrainRobotDrive = new RobotDrive(driveTrainLeftMotor,driveTrainRightMotor);
driveTrainRobotDrive.setSafetyEnabled(true);
driveTrainRobotDrive.setExpiration(0.1);
driveTrainRobotDrive.setSensitivity(0.5);
driveTrainRobotDrive.setMaxOutput(1.0);
intakeintakeMotor = new Talon(2);
LiveWindow.addActuator("Intake","intakeMotor",(Talon) intakeintakeMotor);
pneumaticSystemCompressor = new Compressor(0);
pneumaticSystemDoubleSolenoidPusher = new DoubleSolenoid(0,1);
LiveWindow.addActuator("Pneumatic System","DoubleSolenoidPusher",pneumaticSystemDoubleSolenoidPusher);
sensorBaseUltraSonicMaxbotix = new AnalogInput(0);
LiveWindow.addSensor("SensorBase","UltraSonicMaxbotix",sensorBaseUltraSonicMaxbotix);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
public GearBox(SpeedController motor1,SpeedController motor2,SpeedController motor3,Encoder encoder,DoubleSolenoid shifter) {
m_motor1 = motor1;
m_motor2 = motor2;
m_motor3 = motor3;
m_encoder = encoder;
m_shifter = shifter;
}
项目:Stronghold2016
文件:Shooter.java
public void compress(boolean in) {
if(in) {
m_compress.set(DoubleSolenoid.Value.kForward);
m_compression = m_compressLeft.getVoltage() + m_compressRight.getVoltage();
} else {
m_compress.set(DoubleSolenoid.Value.kReverse);
}
}
项目:2016-Robot
文件:Shooter.java
项目:2016-Robot
文件:Shooter.java
public void setSol(int direction) {
if (direction == 1) {
solenoid.set(DoubleSolenoid.Value.kForward);
} else if (direction == 0) {
solenoid.set(DoubleSolenoid.Value.kOff);
} else if (direction == -1) {
solenoid.set(DoubleSolenoid.Value.kReverse);
}
}
项目:2016-Robot
文件:Drive.java
/**
* Set the solenoid forward or reverse.
*
* @param direction
* the direction to set the solenoid,-1 to low gear.
*/
public void setSol(int direction) {
if (direction == -1) {
// Set drive in low gear
solenoid.set(DoubleSolenoid.Value.kReverse);
setGear(0);
} else if (direction == 1) {
// Set drive in high gear
solenoid.set(DoubleSolenoid.Value.kForward);
setGear(1);
} else {
return;
}
}
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
testDS=new DoubleSolenoid(1,2);
testDS.set(DoubleSolenoid.Value.kOff);
LiveWindow.addActuator("Pneumatics","testDS",testDS);
}
public void setDS(boolean on) {
if(on) {
testDS.set(DoubleSolenoid.Value.kForward);
}
else{
testDS.set(DoubleSolenoid.Value.kReverse);
}
}
项目:FRC-2014-robot-project
文件:ShooterControl.java
private void HandleStatePullback()
{
double currentTime = Timer.getFPGATimestamp();
// assume pullback should finish within 5 seconds
if (m_pullBackEncoderRpm.isEnabled() && (currentTime - m_pullBackStartTime <= 5))
{
Logger.PrintLine("ShooterEncoder: calling m_pullBackEncoderRpm.PeriodicFunc",Logger.LOGGER_MESSAGE_LEVEL_DEBUG);
m_pullBackEncoderRpm.PeriodicFunc();
}
else
{
m_pullBackEncoderRpm.Stop();
if (m_pullBackEncoderRpm.isEnabled())
{
Logger.PrintLine("ShooterEncoder: HandleStatePullback Timed out,moving to slow release state",Logger.LOGGER_MESSAGE_LEVEL_ERROR);
// the pullback ncoder rpm object is still enabled (i.e. the
// limit switch did not fire and we timed out. As a safty measure
// do a slow release
m_currentState = SHOOTER_CONTROL_STATE_SLOW_RELEASE;
// engage the gear
m_gearControl.set(DoubleSolenoid.Value.kReverse);
Timer.delay(0.3);
m_latchReleased = false;
m_pullBackStartTime = Timer.getFPGATimestamp();
}
else
{
// lock the latch
m_latchReleaseServo.set(0);
Timer.delay(0.3);
m_isPulledBack = true;
m_currentState = SHOOTER_CONTROL_STATE_WAIT;
}
}
}
项目:FRC-2014-robot-project
文件:ShooterControl.java
private void HandleStateReleaseFromMidPoint()
{
if(!m_latchReleased)
{
// release the latch
m_latchReleaseServo.set(1);
m_latchReleased = true;
}
Timer.delay(0.4);
//engage the gear
m_gearControl.set(DoubleSolenoid.Value.kReverse);
m_isPulledBack = false;
m_currentState = SHOOTER_CONTROL_STATE_WAIT;
/*if(m_releaseFromMidptEncoderRpm.isEnabled())
{
m_releaseFromMidptEncoderRpm.PeriodicFunc();
}
else
{
if (!m_gearReleased)
{
// set the gear in neutral
m_gearControl.set(DoubleSolenoid.Value.kForward);
m_gearReleased = true;
}
m_isPulledBack = false;
m_currentState = SHOOTER_CONTROL_STATE_WAIT;
}*/
}
项目:FRC-2014-robot-project
文件:IntakeControl.java
IntakeControl(SpeedController speedController,boolean speedControllerReversed,DoubleSolenoid angleControl)
{
m_speedController = speedController;
m_angleControl = angleControl;
if (speedControllerReversed)
{
m_speedControllerDirectionMult = -1;
}
else
{
m_speedControllerDirectionMult = 1;
}
}
项目:FRC-2014-robot-project
文件:IntakeControl.java
public void ChangeAngle()
{
if(m_angleControl.get() == DoubleSolenoid.Value.kReverse)
{
Logger.PrintLine("IntrakeControl.ChangeAngle kForward",Logger.LOGGER_MESSAGE_LEVEL_DEBUG);
m_angleControl.set(DoubleSolenoid.Value.kForward);
}
else
{
Logger.PrintLine("IntrakeControl.ChangeAngle kReverse",Logger.LOGGER_MESSAGE_LEVEL_DEBUG);
m_angleControl.set(DoubleSolenoid.Value.kReverse);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。