How to use the wpilib.LiveWindow.addActuator function in wpilib

To help you get started, we’ve selected a few wpilib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github robotpy / robotpy-wpilib / examples / examples / pacgoat / subsystems / pivot.py View on Github external
# Motor to move the pivot
        self.motor = wpilib.Victor(5)

        # Sensors for measuring the position of the pivot.
        self.upperLimitSwitch = wpilib.DigitalInput(13)
        self.lowerLimitSwitch = wpilib.DigitalInput(12)

        # 0 degrees is vertical facing up.
        # Angle increases the more forward the pivot goes.
        self.pot = wpilib.AnalogPotentiometer(1)

        # Put everything to the LiveWindow for testing.
        wpilib.LiveWindow.addSensor("Pivot", "Upper Limit Switch", self.upperLimitSwitch)
        wpilib.LiveWindow.addSensor("Pivot", "Lower Limit Switch", self.lowerLimitSwitch)
        wpilib.LiveWindow.addSensor("Pivot", "Pot", self.pot)
        wpilib.LiveWindow.addActuator("Pivot", "Motor", self.motor)
        wpilib.LiveWindow.addActuator("Pivot", "PIDSubsystem Controller", self.getPIDController())
github robotpy / robotpy-wpilib / examples / examples / pacgoat / subsystems / shooter.py View on Github external
# Configure Devices
        self.hotGoalSensor = wpilib.DigitalInput(8)
        self.piston1 = wpilib.DoubleSolenoid(0, 3, 4)
        self.piston2 = wpilib.DoubleSolenoid(0, 5, 6)
        self.latchPiston = wpilib.Solenoid(0, 2)
        self.piston1ReedSwitchFront = wpilib.DigitalInput(9)
        self.piston1ReedSwitchBack = wpilib.DigitalInput(11)

        # Put everything to the LiveWindow for testing.
        wpilib.LiveWindow.addSensor("Shooter", "Hot Goal Sensor",
                                    self.hotGoalSensor)
        wpilib.LiveWindow.addSensor("Shooter", "Piston1 Reed Switch Front",
                                    self.piston1ReedSwitchFront)
        wpilib.LiveWindow.addSensor("Shooter", "Piston1 Reed Switch Back",
                                    self.piston1ReedSwitchBack)
        wpilib.LiveWindow.addActuator("Shooter", "Latch Piston",
                                      self.latchPiston)
github robotpy / robotpy-wpilib / examples / examples / pacgoat / subsystems / pivot.py View on Github external
self.motor = wpilib.Victor(5)

        # Sensors for measuring the position of the pivot.
        self.upperLimitSwitch = wpilib.DigitalInput(13)
        self.lowerLimitSwitch = wpilib.DigitalInput(12)

        # 0 degrees is vertical facing up.
        # Angle increases the more forward the pivot goes.
        self.pot = wpilib.AnalogPotentiometer(1)

        # Put everything to the LiveWindow for testing.
        wpilib.LiveWindow.addSensor("Pivot", "Upper Limit Switch", self.upperLimitSwitch)
        wpilib.LiveWindow.addSensor("Pivot", "Lower Limit Switch", self.lowerLimitSwitch)
        wpilib.LiveWindow.addSensor("Pivot", "Pot", self.pot)
        wpilib.LiveWindow.addActuator("Pivot", "Motor", self.motor)
        wpilib.LiveWindow.addActuator("Pivot", "PIDSubsystem Controller", self.getPIDController())
github robotpy / robotpy-wpilib / examples / examples / pacgoat / subsystems / drivetrain.py View on Github external
def __init__(self, robot):

        self.robot = robot

        # Configure drive motors
        self.frontLeftCIM = wpilib.Victor(1)
        self.frontRightCIM = wpilib.Victor(2)
        self.backLeftCIM = wpilib.Victor(3)
        self.backRightCIM = wpilib.Victor(4)
        wpilib.LiveWindow.addActuator("DriveTrain", "Front Left CIM", self.frontLeftCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Front Right CIM", self.frontRightCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Back Left CIM", self.backLeftCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Back Right CIM", self.backRightCIM)

        # Configure the RobotDrive to reflect the fact that all our motors are
        # wired backwards and our drivers sensitivity preferences.
        self.drive = wpilib.RobotDrive(self.frontLeftCIM, self.frontRightCIM, self.backLeftCIM, self.backRightCIM)
        self.drive.setSafetyEnabled(True)
        self.drive.setExpiration(.1)
        self.drive.setSensitivity(.5)
        self.drive.setMaxOutput(1.0)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontLeft, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontRight, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearLeft, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearRight, True)

        # Configure encoders
        self.rightEncoder = wpilib.Encoder(1, 2,
github robotpy / robotpy-wpilib / examples / examples / GearsBot / subsystems / elevator.py View on Github external
# Check for simulation and update PID values
        if robot.isSimulation():
            self.getPIDController().setPID(self.kP_simulation, self.kI_simulation, 0, 0)
            
        self.setAbsoluteTolerance(0.005)
        
        self.motor = wpilib.Victor(5)
        
        # Conversion value of potentiometer varies between the real world and simulation
        if robot.isReal():
            self.pot = wpilib.AnalogPotentiometer(2, -2.0/5)
        else:
            self.pot = wpilib.AnalogPotentiometer(2)    # defaults to meters
            
        # Let's show everything on the LiveWindow
        wpilib.LiveWindow.addActuator("Elevator", "Motor", self.motor)
        wpilib.LiveWindow.addSensor("Elevator", "Pot", self.pot)
        wpilib.LiveWindow.addActuator("Elevator", "PID", self.getPIDController())
github robotpy / robotpy-wpilib / examples / examples / GearsBot / subsystems / elevator.py View on Github external
self.getPIDController().setPID(self.kP_simulation, self.kI_simulation, 0, 0)
            
        self.setAbsoluteTolerance(0.005)
        
        self.motor = wpilib.Victor(5)
        
        # Conversion value of potentiometer varies between the real world and simulation
        if robot.isReal():
            self.pot = wpilib.AnalogPotentiometer(2, -2.0/5)
        else:
            self.pot = wpilib.AnalogPotentiometer(2)    # defaults to meters
            
        # Let's show everything on the LiveWindow
        wpilib.LiveWindow.addActuator("Elevator", "Motor", self.motor)
        wpilib.LiveWindow.addSensor("Elevator", "Pot", self.pot)
        wpilib.LiveWindow.addActuator("Elevator", "PID", self.getPIDController())