本文整理汇总了Java中edu.wpi.first.wpilibj.CANTalon.changeControlMode方法的典型用法代码示例。如果您正苦于以下问题:Java CANTalon.changeControlMode方法的具体用法?Java CANTalon.changeControlMode怎么用?Java CANTalon.changeControlMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.CANTalon
的用法示例。
在下文中一共展示了CANTalon.changeControlMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
public static void initialize(){
climbingWinch = new CANTalon(8); //this value is guessed as of 3/21
release = new Servo(2); //this value is guessed as of 3/21
motorLatch = new Servo(3); //this value is guessed as of 3/21
climbingWinch.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
climbingWinch.enableBrakeMode(true);
}
示例2: Turret
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
/**
* Constructor
*/
private Turret() {
winch = new CANTalon(TURRET);
winch.changeControlMode(PERCENT_VBUS_MODE);
winch.enableBrakeMode(BRAKE_MODE);
lower = new DigitalInput(0);
upper = new DigitalInput(1);
// winch.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Relative);
}
示例3: FlyWheels
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
public FlyWheels() {
left = new CANTalon(RobotMap.LEFT_SHOOTER_MOTOR);
right = new CANTalon(RobotMap.RIGHT_SHOOTER_MOTOR);
left.enableBrakeMode(true);
right.enableBrakeMode(true);
right.changeControlMode(CANTalon.TalonControlMode.Follower);
right.reverseOutput(true);
pusher = new DoubleSolenoid(RobotMap.PUSHER_OUT_PORT, RobotMap.PUSHER_IN_PORT);
wheelSwitch = new DigitalInput(RobotMap.FLYWHEEL_ENCODER_SWITCH);
counter = new Counter(wheelSwitch);
}
示例4: Yaw
import edu.wpi.first.wpilibj.CANTalon; //导入方法依赖的package包/类
public Yaw(){
yaw = new CANTalon(RobotMap.TARGETING_YAW_MOTOR);
yaw.enableControl();
yawZero = yaw.getEncPosition();
yaw.changeControlMode(TalonControlMode.Position);
yaw.setPID(RobotMap.YAW_P, RobotMap.YAW_I, RobotMap.YAW_D);
}
示例5: 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);
}
示例6: 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
}