本文整理汇总了Java中edu.wpi.first.wpilibj.CANTalon.setFeedbackDevice方法的典型用法代码示例。如果您正苦于以下问题:Java CANTalon.setFeedbackDevice方法的具体用法?Java CANTalon.setFeedbackDevice怎么用?Java CANTalon.setFeedbackDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.CANTalon
的用法示例。
在下文中一共展示了CANTalon.setFeedbackDevice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Drivetrain
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
/**
* Constructor
*/
private Drivetrain() {
left = new CANTalon(LEFT);
leftSlave = new CANTalon(LEFT_SLAVE);
right = new CANTalon(RIGHT);
rightSlave = new CANTalon(RIGHT_SLAVE);
left.setFeedbackDevice(FeedbackDevice.QuadEncoder);
right.setFeedbackDevice(FeedbackDevice.QuadEncoder);
setTalonDefaults();
//shifter.set(DoubleSolenoid.Value.kForward);
}
示例2: setTalonSettings
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
private void setTalonSettings(CANTalon talon)
{
talon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
talon.configEncoderCodesPerRev(256);
talon.reverseSensor(false);
talon.configNominalOutputVoltage(0.0D, -0.0D);
talon.configPeakOutputVoltage(12.0D, -12.0D);
}
示例3: Robot
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
public Robot() {
motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1.
// This sets the mode of the m_motor. The options are:
// PercentVbus: basic throttle; no closed-loop.
// Current: Runs the motor with the specified current if possible.
// Speed: Runs a PID control loop to keep the motor going at a constant
// speed using the specified sensor.
// Position: Runs a PID control loop to move the motor to a specified move
// the motor to a specified sensor position.
// Voltage: Runs the m_motor at a constant voltage, if possible.
// Follower: The m_motor will run at the same throttle as the specified
// other talon.
motor.changeControlMode(CANTalon.ControlMode.Position);
// This command allows you to specify which feedback device to use when doing
// closed-loop control. The options are:
// AnalogPot: Basic analog potentiometer
// QuadEncoder: Quadrature Encoder
// AnalogEncoder: Analog Encoder
// EncRising: Counts the rising edges of the QuadA pin (allows use of a
// non-quadrature encoder)
// EncFalling: Same as EncRising, but counts on falling edges.
motor.setFeedbackDevice(CANTalon.FeedbackDevice.AnalogPot);
// This sets the basic P, I , and D values (F, Izone, and rampRate can also
// be set, but are ignored here).
// These must all be positive floating point numbers (reverseSensor will
// multiply the sensor values by negative one in case your sensor is flipped
// relative to your motor).
// These values are in units of throttle / sensor_units where throttle ranges
// from -1023 to +1023 and sensor units are from 0 - 1023 for analog
// potentiometers, encoder ticks for encoders, and position / 10ms for
// speeds.
motor.setPID(1.0, 0.0, 0.0);
}
示例4: init
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
public static void init() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveleftDrive = new CANTalon(3);
LiveWindow.addActuator("Drive", "leftDrive", driveleftDrive);
driverightDrive = new CANTalon(4);
LiveWindow.addActuator("Drive", "rightDrive", driverightDrive);
driveRobotDrive21 = new RobotDrive(driveleftDrive, driverightDrive);
driveRobotDrive21.setSafetyEnabled(true);
driveRobotDrive21.setExpiration(0.1);
driveRobotDrive21.setSensitivity(0.5);
driveRobotDrive21.setMaxOutput(1.0);
armsingleArm = new CANTalon(9);
armsingleArm.changeControlMode(TalonControlMode.PercentVbus);
armsingleArm.setFeedbackDevice(FeedbackDevice.QuadEncoder);
/*
armsingleArm.setPID(.7, 0.000001, 0);
//armsingleArm.setPosition(0);
armsingleArm.set(RobotMap.armsingleArm.get());
*/
LiveWindow.addActuator("Arm", "singleArm", armsingleArm);
LiveWindow.addSensor("Arm", "singleArm", armsingleArm);
intakeMotor = new CANTalon(8);
//LiveWindow.addActuator("Intake", "intakeMotor", intakeMotor);
shooterrightShooter = new CANTalon(6);
//LiveWindow.addActuator("Shooter", "rightShooter", shooterrightShooter);
shooterleftShooter = new CANTalon(7);
//LiveWindow.addActuator("Shooter", "leftShooter", shooterleftShooter);
shootershootPlunger = new CANTalon(11);
//LiveWindow.addActuator("Shooter", "shootPlunger", shootershootPlunger);
aimscissorLift = new CANTalon(10);
//LiveWindow.addActuator("Aim", "scissorLift", aimscissorLift);
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}