本文整理汇总了Java中edu.wpi.first.wpilibj.PowerDistributionPanel类的典型用法代码示例。如果您正苦于以下问题:Java PowerDistributionPanel类的具体用法?Java PowerDistributionPanel怎么用?Java PowerDistributionPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PowerDistributionPanel类属于edu.wpi.first.wpilibj包,在下文中一共展示了PowerDistributionPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
chooser = new SendableChooser<Command>();
chassis = new Chassis();
intake = new Intake();
winch = new Winch();
// shooter = new Shooter();
oi = new OI();
imu = new ADIS16448_IMU(ADIS16448_IMU.Axis.kX);
pdp = new PowerDistributionPanel();
chooser.addDefault("Drive Straight", new DriveStraight(73, 0.5));
//chooser.addObject("Left Gear Curve", new LeftGearCurve());
chooser.addObject("Left Gear Turn", new LeftGearTurn());
//chooser.addObject("Right Gear Curve", new RightGearCurve());
chooser.addObject("Right Gear Turn", new RightGearTurn());
chooser.addObject("Middle Gear", new StraightGear());
chooser.addObject("Turn in place", new TurnDegrees(60, .2));
SmartDashboard.putData("Autonomous Chooser", chooser);
}
示例2: init
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
public static void init() {
driveTrainCIMRearLeft = new CANTalon(2); // rear left motor
driveTrainCIMFrontLeft = new CANTalon(12); //
driveTrainCIMRearRight = new CANTalon(1);
driveTrainCIMFrontRight = new CANTalon(11);
driveTrainRobotDrive41 = new RobotDrive(driveTrainCIMRearLeft, driveTrainCIMFrontLeft,
driveTrainCIMRearRight, driveTrainCIMFrontRight);
climberClimber = new CANTalon(3);
c1 = new Talon(5);
pDPPowerDistributionPanel1 = new PowerDistributionPanel(0);
gyro = new ADXRS450_Gyro(Port.kOnboardCS0);
c2 = new Talon(6);
ultra = new AnalogInput(0);
LiveWindow.addSensor("PDP", "PowerDistributionPanel 1", pDPPowerDistributionPanel1);
LiveWindow.addSensor("Ultra", "Ultra", ultra);
// LiveWindow.addActuator("Intake", "Intake", intakeIntake);
LiveWindow.addActuator("Climber", "Climber", climberClimber);
LiveWindow.addActuator("RearLeft (2)", "Drivetrain", driveTrainCIMRearLeft);
LiveWindow.addActuator("FrontLeft (12)", "Drivetrain", driveTrainCIMFrontLeft);
LiveWindow.addActuator("RearRight (1)", "Drivetrain", driveTrainCIMRearRight);
LiveWindow.addActuator("FrontRight (11)", "Drivetrain", driveTrainCIMFrontRight);
LiveWindow.addActuator("Drive Train", "Gyro", gyro);
// LiveWindow.addActuator("Shooter", "Shooter", shooter1);
}
示例3: HardwareAdaptor
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
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();
}
示例4: robotInit
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
@Override
public void robotInit() {
driveSys = new DriveSubsystem();
driveSys.initDefaultCommand();
climberSys = new ClimberSubsystem();
climberSys.registerButtons();
cameras = new Cameras();
cameras.start();
piSys = new PISubsystem();
piSys.initDefaultCommand();
pdp = new PowerDistributionPanel();
autoChooser = new AutoChooser();
SmartDashboard.putData("Auto Choices", autoChooser);
SmartDashboard.putData("Reclibrate RPi", new RPiCalibration());
SmartDashboard.putNumber("RPi Target Duty Cycle", VisionRotate.TARGET_DUTY_CYCLE);
}
示例5: operatorControl
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* Runs the motors with arcade steering.
*/
@Override
public void operatorControl() {
PowerDistributionPanel panel = new PowerDistributionPanel();
while (isOperatorControl() && isEnabled()) {
talon1.set(-j.getAxis(AxisType.kZ));
talon2.set(j.getAxis(AxisType.kZ));
SmartDashboard.putNumber("JoystickValue", j.getAxis(AxisType.kZ));
SmartDashboard.putNumber("Talon1", talon1.getOutputCurrent());
SmartDashboard.putNumber("Talon2", talon2.getOutputCurrent());
SmartDashboard.putNumber("Talon1 PDP", panel.getCurrent(11));
SmartDashboard.putNumber("Talon2 PDP", panel.getCurrent(4));
agitator.set(j1.getAxis(AxisType.kZ));
SmartDashboard.putNumber("Joystick2Value", j1.getAxis(AxisType.kZ));
}
}
示例6: Robot
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
public Robot() { // initialize variables in constructor
stick = new Joystick(RobotMap.JOYSTICK_PORT); // set the stick to refer to joystick #0
button = new JoystickButton(stick, RobotMap.BTN_TRIGGER);
myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
myRobot.setExpiration(RobotDrive.kDefaultExpirationTime); // set expiration time for motor movement if error occurs
pdp = new PowerDistributionPanel(); // instantiate class to get PDP values
compressor = new Compressor(); // Compressor is controlled automatically by PCM
solenoid = new DoubleSolenoid(RobotMap.SOLENOID_PCM_PORT1, RobotMap.SOLENOID_PCM_PORT2); // solenoid on PCM port #0 & #1
/*camera = CameraServer.getInstance();
camera.setQuality(50);
camera.setSize(200);*/
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); // create the image frame for cam
session = NIVision.IMAQdxOpenCamera("cam0",
NIVision.IMAQdxCameraControlMode.CameraControlModeController); // get reference to camera
NIVision.IMAQdxConfigureGrab(session); // grab current streaming session
}
示例7: SensorInput
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* Instantiates the Sensor Input module to read all sensors connected to the roboRIO.
*/
private SensorInput() {
limit_left = new DigitalInput(ChiliConstants.left_limit);
limit_right = new DigitalInput(ChiliConstants.right_limit);
accel = new BuiltInAccelerometer(Accelerometer.Range.k2G);
gyro = new Gyro(ChiliConstants.gyro_channel);
pdp = new PowerDistributionPanel();
left_encoder = new Encoder(ChiliConstants.left_encoder_channelA, ChiliConstants.left_encoder_channelB, false);
right_encoder = new Encoder(ChiliConstants.right_encoder_channelA, ChiliConstants.right_encoder_channelB, true);
gyro_i2c = new GyroITG3200(I2C.Port.kOnboard);
gyro_i2c.initialize();
gyro_i2c.reset();
gyro.initGyro();
left_encoder.setDistancePerPulse(ChiliConstants.kDistancePerPulse);
right_encoder.setDistancePerPulse(ChiliConstants.kDistancePerPulse);
}
示例8: CANObject
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* Creates Power Distribution Board Object
*
* @param newPdp
* the CAN Power Distribution Board associated with this object
* @param newCanId
* the ID of the CAN object
*/
public CANObject (final PowerDistributionPanel newPdp, int newCanId)
{
pdp = newPdp;
canId = newCanId;
typeId = 4;
// if(useDebug == true)
// {
// System.out.println("The pdp is " + talon);
// System.out.println("The canId of the CANJaguar is " + canId);
// System.out.println("The type Id of the CANJaguar is " + typeId);
// }
}
示例9: getPDP
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* // * Checks if the CAN Device is the Power Distribution Panel
* // *
*
* @return Returns Power Distribution Panel if the type ID is 3, if not returns
* null
*/
public PowerDistributionPanel getPDP ()
{
if (typeId == 4)
{
return pdp;
}
return null;
}
示例10: PDP
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* Initializes the wrapper for a PDP at the given module.
* @param module the module
*/
public PDP(int module){
super("PDP"+module, FlashboardSendableType.PDP);
pdp = new PowerDistributionPanel(module);
voltage = pdp.getVoltage();
}
示例11: robotInit
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* 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);
}
示例12: HarvesterRollers
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
public HarvesterRollers() {
shooterWheelA = new CANTalon(RobotMap.HARVESTER_SHOOTER_WHEEL_A);//Construct shooter A as CANTalon, this should have encoder into it
shooterWheelB = new CANTalon(RobotMap.HARVESTER_SHOOTER_WHEEL_B);//Construct shooter B as CANTalon
// shooterWheelB.changeControlMode(CANTalon.TalonControlMode.Follower);//turn shooter motor B to a slave
// shooterWheelB.set(shooterWheelA.get());//slave shooter motor B to shooter motor A
harvesterBallControl = new CANTalon(RobotMap.HARVESTER_BALL_CONTROL);
ballSensorLeft = new DigitalInput(RobotMap.BALL_SENSOR_LEFT);
ballSensorRight = new DigitalInput(RobotMap.BALL_SENSOR_RIGHT);
pdp = new PowerDistributionPanel();
}
示例13: VoltageCompensatedShooter
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
public VoltageCompensatedShooter(CANTalon shooter, double voltageLevelToMaintain)
{
m_shooter = shooter;
m_panel = new PowerDistributionPanel();
m_voltageLevelToMaintain = voltageLevelToMaintain;
turnOff();
}
示例14: getCurrent
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
/**
* Get the current on any channel on the Power Distribution Panel.
* @param channel - the channel number on the Power Distribution Panel.
* @return double - the current on the channel or 0 if the channel number is invalid.
*/
public double getCurrent(int channel) {
if (channel >= 0 && channel < PowerDistributionPanel.kPDPChannels) {
return powerDistributionPanel.getCurrent(channel);
}
System.out.println("Invalid channel number (" + channel + ") requested for PowerSubsystem.getCurrent()");
return 0;
}
示例15: setupSensors
import edu.wpi.first.wpilibj.PowerDistributionPanel; //导入依赖的package包/类
private void setupSensors() {
navX = new TurtleNavX(I2C.Port.kOnboard);
try {
lidar = new LIDARLite(I2C.Port.kMXP);
// new LIDARSerial(SerialPort.Port.kUSB1);
} catch (Exception e) {
e.printStackTrace();
lidar = new TurtleFakeDistanceEncoder();
}
pdp = new PowerDistributionPanel();
}