项目:snobot-2017
文件:Snobot.java
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotinit()
{
// PWM's
mTestMotor1 = new Talon(0);
mTestMotor2 = new Jaguar(1);
mServo = new Servo(2);
// Digital IO
mDigitalOutput = new DigitalOutput(0);
mRightEncoder = new Encoder(4,5);
mLeftEncoder = new Encoder(1,2);
mUltrasonic = new Ultrasonic(7,6);
// Analog IO
mAnalogGryo = new AnalogGyro(0);
mPotentiometer = new AnalogPotentiometer(1);
// Solenoid
mSolenoid = new Solenoid(0);
// Relay
mRelay = new Relay(0);
// Joysticks
mJoystick1 = new Joystick(0);
mJoystick2 = new XBoxController(1);
// SPI
mSpiGryo = new ADXRS450_Gyro();
// Utilities
mTimer = new Timer();
mPDP = new PowerdistributionPanel();
Preferences.getInstance().putDouble("Motor One Speed",.5);
}
项目:Stronghold2016-340
文件:ClawArm.java
public ClawArm() {
System.out.println("Claw arm constructor method called");
armMotor = new TalonSRX(RobotMap.ClawArmMotor);
clawPiston = new Solenoid(RobotMap.ClawPiston);
armAngleSensor = new AnalogPotentiometer(RobotMap.ClawArmAngleSensor,270);
bottomSwitch = new DigitalInput(RobotMap.ClawBottomSwitch);
topSwitch = new DigitalInput(RobotMap.ClawTopSwitch);
System.out.println("Claw arm constructor method complete.");
}
public void robotinit(){
driveStick= new JoyStickCustom(1,DEADZONE);
secondStick=new JoyStickCustom(2,DEADZONE);
frontLeft= new Talon(1);
rearLeft= new Talon(2);
frontRight= new Talon(3);
rearRight= new Talon(4);
timer=new Timer();
timer.start();
armM = new Victor(7);
rollers =new Victor(6);
mainDrive=new RobotDrive(frontLeft,rearLeft,frontRight,rearRight);
mainDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
mainDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight,true);
armP = new AnalogPotentiometer(1);
distance= new AnalogChannel(2);
ultra=new Ultrasonic(6,7);
ultra.setAutomaticMode(true);
compress=new Compressor(5,1);
handJoint=new Pneumatics(3,4);
//ultra = new Ultrasonic(6,5);
//ultra.setAutomaticMode(true);
winch = new Winch(secondStick);
}
项目:frc-2014
文件:IntakeArm.java
/**
* Constructor takes references two talons and pot used by intake
* system.
* @param rollerMotors
* @param armMotors
* @param pot
*/
public IntakeArm(Talon rollerMotors,Talon armMotors,AnalogPotentiometer pot) {
this.armMotors = armMotors;
this.rollerMotors = rollerMotors;
this.pot = pot;
currentSetpoint = UP_POSITION;
armPID = new PIDController(kP,kI,kD,pot,armMotors);
armPID.setAbsolutetolerance(ABSOLUTE_TOLERANCE);
armPID.setoutputRange(-1.0,1.0);
}
public ClawPivotSubsystem() {
super("ClawSubsystem");
motor = new Victor(RobotMap.CLAW_PIVOT.MOTOR);
potentiometer = new AnalogPotentiometer(RobotMap.CLAW_PIVOT.POTENTIOMETER);
clawPID = new PIDController649(kP,potentiometer,this);
clawPID.setAbsolutetolerance(0.01);
clawPID.setoutputRange(MAX_FORWARD_SPEED,MAX_BACKWARD_SPEED);
}
项目:StormRobotics2017
文件:StringPot.java
public StringPot(int Num,double maxSafeVal) {
_pot = new AnalogPotentiometer(Num);
VAL_MAX_SAFE = maxSafeVal;
}
项目:StormRobotics2017
文件:RotaryPot.java
public RotaryPot(int Num,double maxSafeVal) {
_pot = new AnalogPotentiometer(Num);
VAL_MAX_SAFE = maxSafeVal;
}
项目:El-Jefe-2017
文件:Kicker.java
public Kicker(){
kickerPot = new AnalogPotentiometer(RobotMap.kickerPotentiometer,3600,kickerStartVal);
kickerMotor = new Talon(RobotMap.kickerMotor);
}
项目:turtleshell
文件:Elevator.java
/**
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Wrist Pot",(AnalogPotentiometer) pot);
}
项目:turtleshell
文件:Wrist.java
/**
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Wrist Angle",(AnalogPotentiometer) pot);
}
public void init() {
motorLeft = new Talon(1);
motorRight = new Talon(2);
System.out.println("[INFO] TALON[1&2]: Created!");
elToro1 = new Talon(3);
elToro2 = new Talon(4);
System.out.println("[INFO] TALON[3&4]: Created!");
robotdrive = new RobotDriveSteering(motorLeft,motorRight);
robotdrive.setInvertedMotor(RobotDriveSteering.MotorType.kRearLeft,true);
robotdrive.setInvertedMotor(RobotDriveSteering.MotorType.kRearRight,true);
compressor = new Compressor(1,1); // presureSwitchDigitalInput,RelayOut
compressor.start();
wormgear = new Relay(2);
spreader = new Relay(3);
System.out.println("[INFO] RELAY[1&2&3]: Created!");
joystick = new Joystick(1);
//joystick2 = new Joystick(2);
System.out.println("[INFO] JOYSTICK[1&2]: Created!");
cock = new Solenoid(1);
uncock = new Solenoid(2);
lock = new Solenoid(3);
fire = new Solenoid(4);
System.out.println("[INFO] Digital I/O: Enabled.");
sonic = new Ultrasonic(4,2);
sonic.setEnabled(true);
sonic2 = new AnalogChannel(3);
pot = new AnalogPotentiometer(2,10);
autonomousTimer = new Timer();
t = new Timer();
LCD = DriverStationLCD.getInstance();
ds = DriverStation.getInstance();
System.out.println("[INFO] Robot Initialized");
}
项目:strongback-java
文件:Hardware.java
/**
* Create a new {@link AngleSensor} from an {@link AnalogPotentiometer} using the specified channel,scaling,and
* offset. This method is often used when the offset can be hard-coded by measuring the value of the potentiometer at
* the mechanism's zero-point. On the other hand,if a limit switch is used to always determine the position of the
* mechanism upon startup,then see {@link #potentiometer(int,double)}.
* <p>
* The scale factor multiplies the 0-1 ratiometric value to return the angle in degrees.
* <p>
* For example,let's say you have an ideal 10-turn linear potentiometer attached to a motor attached by chains and a
* 25x gear reduction to an arm. If the potentiometer (attached to the motor shaft) turned its full 3600 degrees,the
* arm would rotate 144 degrees. Therefore,the {@code fullVoltageRangetoInches} scale factor is
* {@code 144 degrees / 5 V},or {@code 28.8 degrees/volt}.
* <p>
* To prevent the potentiometer from breaking due to minor shifting in alignment of the mechanism,the potentiometer may
* be installed with the "zero-point" of the mechanism (e.g.,arm in this case) a little ways into the potentiometer's
* range (for example 30 degrees). In this case,the {@code offset} value of {@code 30} is determined from the
* mechanical design.
*
* @param channel The analog channel this potentiometer is plugged into.
* @param fullVoltageRangetodegrees The scaling factor multiplied by the analog voltage value to obtain the angle in
* degrees.
* @param offsetIndegrees The offset in degrees that the angle sensor will subtract from the underlying value before
* returning the angle
* @return the angle sensor that uses the potentiometer on the given channel; never null
*/
public static AngleSensor potentiometer(int channel,double fullVoltageRangetodegrees,double offsetIndegrees) {
AnalogPotentiometer pot = new AnalogPotentiometer(channel,fullVoltageRangetodegrees,offsetIndegrees);
return AngleSensor.create(pot::get);
}
项目:strongback-java
文件:Hardware.java
/**
* Create a new {@link distanceSensor} from an {@link AnalogPotentiometer} using the specified channel,and
* offset. This method is often used when the offset can be hard-coded by first measuring the value of the potentiometer
* at the mechanism's zero-point. On the other hand,double)}.
* <p>
* The scale factor multiplies the 0-1 ratiometric value to return useful units,and an offset to add after the scaling.
* Generally,the most useful scale factor will be the angular or linear full scale of the potentiometer.
* <p>
* For example,let's say you have an ideal single-turn linear potentiometer attached to a robot arm. This pot will turn
* 270 degrees over the 0V-5V range while the end of the arm travels 20 inches. Therefore,the
* {@code fullVoltageRangetoInches} scale factor is {@code 20 inches / 5 V},or {@code 4 inches/volt}.
* <p>
* To prevent the potentiometer from breaking due to minor shifting in alignment of the mechanism,arm in this case) a little ways into the potentiometer's
* range (for example 10 degrees). In this case,the {@code offset} value is measured from the physical mechanical
* design and can be specified to automatically remove the 10 degrees from the potentiometer output.
*
* @param channel The analog channel this potentiometer is plugged into.
* @param fullVoltageRangetoInches The scaling factor multiplied by the analog voltage value to obtain inches.
* @param offsetininches The offset in inches that the distance sensor will subtract from the underlying value before
* returning the distance
* @return the distance sensor that uses the potentiometer on the given channel; never null
*/
public static distanceSensor potentiometer(int channel,double fullVoltageRangetoInches,double offsetininches) {
AnalogPotentiometer pot = new AnalogPotentiometer(channel,fullVoltageRangetoInches,offsetininches);
return distanceSensor.create(pot::get);
}
项目:frc-2014
文件:IntakeArm.java
/**
* Constructor takes PWM channels for talons and channel for pot on analog
* breakout port
* @param rollerMotorChannel
* @param armMotorChannel
* @param potChannel
*/
public IntakeArm(int rollerMotorChannel,int armMotorChannel,int potChannel) {
this(new Talon(rollerMotorChannel),new Talon(armMotorChannel),new AnalogPotentiometer(potChannel));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。