Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def robotInit(self):
"""
This function is run when the robot is first started up and should be
used for any initialization code.
"""
# Initialize the subsystems
self.drivetrain = DriveTrain(self)
self.collector = Collector(self)
self.shooter = Shooter(self)
self.pneumatics = Pneumatics(self)
self.pivot = Pivot(self)
wpilib.SmartDashboard.putData(self.drivetrain)
wpilib.SmartDashboard.putData(self.collector)
wpilib.SmartDashboard.putData(self.shooter)
wpilib.SmartDashboard.putData(self.pneumatics)
wpilib.SmartDashboard.putData(self.pivot)
# This MUST be here. If the OI creates Commands (which it very likely
# will), constructing it during the construction of CommandBase (from
# which commands extend), subsystems are not guaranteed to be
# yet. Thus, their requires() statements may grab null pointers. Bad
# news. Don't move it.
self.oi = OI(self)
#instantiate the command used for the autonomous period
self.autoChooser = wpilib.SendableChooser()
self.autoChooser.addDefault("Drive and Shoot", DriveAndShootAutonomous(self))
self.autoChooser.addObject("Drive Forward", DriveForward(self))
wpilib.SmartDashboard.putData("Auto Mode", self.autoChooser)
self.autonomousCommand = None
def robotInit(self):
"""
This function is run when the robot is first started up and should be
used for any initialization code.
"""
# Initialize the subsystems
self.drivetrain = DriveTrain(self)
self.collector = Collector(self)
self.shooter = Shooter(self)
self.pneumatics = Pneumatics(self)
self.pivot = Pivot(self)
wpilib.SmartDashboard.putData(self.drivetrain)
wpilib.SmartDashboard.putData(self.collector)
wpilib.SmartDashboard.putData(self.shooter)
wpilib.SmartDashboard.putData(self.pneumatics)
wpilib.SmartDashboard.putData(self.pivot)
# This MUST be here. If the OI creates Commands (which it very likely
# will), constructing it during the construction of CommandBase (from
# which commands extend), subsystems are not guaranteed to be
# yet. Thus, their requires() statements may grab null pointers. Bad
# news. Don't move it.
self.oi = OI(self)
#instantiate the command used for the autonomous period
self.autoChooser = wpilib.SendableChooser()
self.autoChooser.addDefault("Drive and Shoot", DriveAndShootAutonomous(self))
self.autoChooser.addObject("Drive Forward", DriveForward(self))
wpilib.SmartDashboard.putData("Auto Mode", self.autoChooser)
def __init__(self, robot):
self.joy = wpilib.Joystick(0)
# Put Some buttons on the SmartDashboard
SmartDashboard.putData("Elevator Bottom", SetElevatorSetpoint(robot, 0));
SmartDashboard.putData("Elevator Platform", SetElevatorSetpoint(robot, 0.2));
SmartDashboard.putData("Elevator Top", SetElevatorSetpoint(robot, 0.3));
SmartDashboard.putData("Wrist Horizontal", SetWristSetpoint(robot, 0));
SmartDashboard.putData("Raise Wrist", SetWristSetpoint(robot, -45));
SmartDashboard.putData("Open Claw", OpenClaw(robot));
SmartDashboard.putData("Close Claw", CloseClaw(robot));
SmartDashboard.putData("Deliver Soda", Autonomous(robot));
# Create some buttons
d_up = JoystickButton(self.joy, 5)
d_right = JoystickButton(self.joy, 6)
d_down = JoystickButton(self.joy, 7)
d_left = JoystickButton(self.joy, 8)
l2 = JoystickButton(self.joy, 9)
r2 = JoystickButton(self.joy, 10)
l1 = JoystickButton(self.joy, 11)
r1 = JoystickButton(self.joy, 12)
def __init__(self, robot):
self.joystick = wpilib.Joystick(0)
JoystickButton(self.joystick, 12).whenPressed(LowGoal(robot))
JoystickButton(self.joystick, 10).whenPressed(Collect(robot))
JoystickButton(self.joystick, 11).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT))
JoystickButton(self.joystick, 9).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT_NEAR))
DoubleButton(self.joystick, 2, 3).whenActive(Shoot(robot))
#SmartDashboard Buttons
SmartDashboard.putData("Drive Forward", DriveForward(robot,2.25))
SmartDashboard.putData("Drive Backward", DriveForward(robot,-2.25))
SmartDashboard.putData("Start Rollers", SetCollectionSpeed(robot,Collector.FORWARD))
SmartDashboard.putData("Stop Rollers", SetCollectionSpeed(robot,Collector.STOP))
SmartDashboard.putData("Reverse Rollers", SetCollectionSpeed(robot,Collector.REVERSE))
def __init__(self, robot):
self.joy = wpilib.Joystick(0)
# Put Some buttons on the SmartDashboard
SmartDashboard.putData("Elevator Bottom", SetElevatorSetpoint(robot, 0));
SmartDashboard.putData("Elevator Platform", SetElevatorSetpoint(robot, 0.2));
SmartDashboard.putData("Elevator Top", SetElevatorSetpoint(robot, 0.3));
SmartDashboard.putData("Wrist Horizontal", SetWristSetpoint(robot, 0));
SmartDashboard.putData("Raise Wrist", SetWristSetpoint(robot, -45));
SmartDashboard.putData("Open Claw", OpenClaw(robot));
SmartDashboard.putData("Close Claw", CloseClaw(robot));
SmartDashboard.putData("Deliver Soda", Autonomous(robot));
# Create some buttons
d_up = JoystickButton(self.joy, 5)
d_right = JoystickButton(self.joy, 6)
d_down = JoystickButton(self.joy, 7)
d_left = JoystickButton(self.joy, 8)
"""
This function is run when the robot is first started up and should be
used for any initialization code.
"""
# Initialize the subsystems
self.drivetrain = DriveTrain(self)
self.collector = Collector(self)
self.shooter = Shooter(self)
self.pneumatics = Pneumatics(self)
self.pivot = Pivot(self)
wpilib.SmartDashboard.putData(self.drivetrain)
wpilib.SmartDashboard.putData(self.collector)
wpilib.SmartDashboard.putData(self.shooter)
wpilib.SmartDashboard.putData(self.pneumatics)
wpilib.SmartDashboard.putData(self.pivot)
# This MUST be here. If the OI creates Commands (which it very likely
# will), constructing it during the construction of CommandBase (from
# which commands extend), subsystems are not guaranteed to be
# yet. Thus, their requires() statements may grab null pointers. Bad
# news. Don't move it.
self.oi = OI(self)
#instantiate the command used for the autonomous period
self.autoChooser = wpilib.SendableChooser()
self.autoChooser.addDefault("Drive and Shoot", DriveAndShootAutonomous(self))
self.autoChooser.addObject("Drive Forward", DriveForward(self))
wpilib.SmartDashboard.putData("Auto Mode", self.autoChooser)
self.autonomousCommand = None
self.joystick = wpilib.Joystick(0)
JoystickButton(self.joystick, 12).whenPressed(LowGoal(robot))
JoystickButton(self.joystick, 10).whenPressed(Collect(robot))
JoystickButton(self.joystick, 11).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT))
JoystickButton(self.joystick, 9).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT_NEAR))
DoubleButton(self.joystick, 2, 3).whenActive(Shoot(robot))
#SmartDashboard Buttons
SmartDashboard.putData("Drive Forward", DriveForward(robot,2.25))
SmartDashboard.putData("Drive Backward", DriveForward(robot,-2.25))
SmartDashboard.putData("Start Rollers", SetCollectionSpeed(robot,Collector.FORWARD))
SmartDashboard.putData("Stop Rollers", SetCollectionSpeed(robot,Collector.STOP))
SmartDashboard.putData("Reverse Rollers", SetCollectionSpeed(robot,Collector.REVERSE))
def __init__(self, robot):
self.joystick = wpilib.Joystick(0)
JoystickButton(self.joystick, 12).whenPressed(LowGoal(robot))
JoystickButton(self.joystick, 10).whenPressed(Collect(robot))
JoystickButton(self.joystick, 11).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT))
JoystickButton(self.joystick, 9).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT_NEAR))
DoubleButton(self.joystick, 2, 3).whenActive(Shoot(robot))
#SmartDashboard Buttons
SmartDashboard.putData("Drive Forward", DriveForward(robot,2.25))
SmartDashboard.putData("Drive Backward", DriveForward(robot,-2.25))
SmartDashboard.putData("Start Rollers", SetCollectionSpeed(robot,Collector.FORWARD))
SmartDashboard.putData("Stop Rollers", SetCollectionSpeed(robot,Collector.STOP))
SmartDashboard.putData("Reverse Rollers", SetCollectionSpeed(robot,Collector.REVERSE))
def __init__(self, robot):
self.joy = wpilib.Joystick(0)
# Put Some buttons on the SmartDashboard
SmartDashboard.putData("Elevator Bottom", SetElevatorSetpoint(robot, 0));
SmartDashboard.putData("Elevator Platform", SetElevatorSetpoint(robot, 0.2));
SmartDashboard.putData("Elevator Top", SetElevatorSetpoint(robot, 0.3));
SmartDashboard.putData("Wrist Horizontal", SetWristSetpoint(robot, 0));
SmartDashboard.putData("Raise Wrist", SetWristSetpoint(robot, -45));
SmartDashboard.putData("Open Claw", OpenClaw(robot));
SmartDashboard.putData("Close Claw", CloseClaw(robot));
SmartDashboard.putData("Deliver Soda", Autonomous(robot));
# Create some buttons
d_up = JoystickButton(self.joy, 5)
d_right = JoystickButton(self.joy, 6)
d_down = JoystickButton(self.joy, 7)
d_left = JoystickButton(self.joy, 8)
l2 = JoystickButton(self.joy, 9)
r2 = JoystickButton(self.joy, 10)
l1 = JoystickButton(self.joy, 11)
r1 = JoystickButton(self.joy, 12)
# Connect the buttons to commands
d_up.whenPressed(SetElevatorSetpoint(robot, 0.2))