def robotInit(self): subsystems.init() oi.init() self.teleopProgram = wpilib.command.CommandGroup() self.teleopProgram.addParallel(FollowJoystick()) self.teleopProgram.addParallel(Intake())
def robotInit(self): print('Robot Base - robotInit called') # subsystems must be initialized before things that use them # ensure order of operations is correct, just like importing to avoid issues with dependencies subsystems.init() oi.init()
def robotInit(self): ''' This is a good place to set up your subsystems and anything else that you will need to access later. ''' subsystems.init() self.autoChooser = wpilib.SendableChooser() # self.autoChooser.addDefault('No Auto', NoAuto()) self.autoChooser.addDefault('Center Switch Auto', CenterSwitchAuto()) self.autoChooser.addObject('Left Switch Auto', LeftSwitchAuto()) # self.autoChooser.addObject('Center Switch Auto', CenterSwitchAuto()) self.autoChooser.addObject('Right Switch Auto', RightSwitchAuto()) self.autoChooser.addObject('Cross Line Auto', CrossLineAuto()) self.autoChooser.addObject('Left Switch Safe', LeftSwitchSafe()) self.autoChooser.addObject('Right Switch Safe', RightSwitchSafe()) wpilib.SmartDashboard.putData('Auto Mode', self.autoChooser) self.autonomousCommand = None ''' Since OI instantiates commands and commands need access to subsystems, OI must be initialized after subsystems. ''' OI.init() # Initialize the camera server wpilib.CameraServer.launch('vision.py:main')
def robotInit(self): print('Robot Base - robotInit called') # subsystems must be initialized before things that use them # ensure order of operations is correct, just like importing to avoid issues with dependencies subsystems.init() oi.init() #if robotmap.sensors.hasAHRS: # try: # robotmap.sensors.ahrs = navx.AHRS.create_spi() # # use via robotmap.sensors.ahrs.getAngle() or getYaw() # print('robotInit: NavX Setup') # except: # if not DriverStation.getInstance().isFmsAttached(): # raise print('robotInit: Starting Camera Server') try: wpilib.CameraServer.launch() print('robotInit: Camera Rolling') except Exception as e: print( 'robotInit: Error! Exception caught starting cameraServer: {}'. format(e))
def robotInit(self): """ Set up everything. """ subsystems.init() self.logger = logging.getLogger("robot") self.sd = NetworkTables.getTable("SmartDashboard") # set autonomous modes self.sd.putStringArray("autonomous/options", [ "left", "center", "right", "boilerleft", "boilerright", "borkleft", "borkright" ]) self.sd.putString("autonomous/selected", "left") self.sd.putBoolean("isautonomous", False) # Rotate PID values (for tuning) self.sd.putNumber("rotate/kp", 0.007) self.sd.putNumber("rotate/ki", 0.001) self.sd.putNumber("rotate/kd", 0.05) self.sd.putNumber("rotate/kf", 0.0) # drive-to-rod PID values (for tuning) self.sd.putNumber("rod/kp", 0.15) self.sd.putNumber("rod/ki", 0) self.sd.putNumber("rod/kd", 0) self.sd.putNumber("rod/kf", 0.0) self.sd.putNumber("rod/ktolerance", 0) # RectifiedDrive PID values (for tuning) self.sd.putNumber("drive/kp", 0.07) self.sd.putNumber("drive/ki", 0.0) self.sd.putNumber("drive/kd", 0) self.sd.putNumber("drive/kf", 0.05) self.sd.putNumber("drive/ktolerance", 0.1) # Motor PID values (for tuning) self.sd.putNumber("motors/kp", 0.3) self.sd.putNumber("motors/ki", 0) self.sd.putNumber("motors/kd", 0) self.sd.putNumber("motors/kf", 0.7) self.sd.putNumber("direction", 1) self.sd.putBoolean("lockonRunning", False) self.sd.putBoolean("climbDownCommand", False) self.sd.putBoolean("slowmode", False) navx.init() sonar.init() oi.init() switches.init() wpilib.CameraServer.launch('inputs/camera.py:start')
def robotInit(self): '''Robot initialization function''' self.map = RobotMap() self.createMotors(self.map.CAN.driveMotors) #inti the drive train driveTrain.init(self.driveMotors) subsystems.init() self.autonomousProgram = autonomous.AutonomousProgram() self.driveStick = wpilib.Joystick( self.map.joystickMap.movementJoystick)
def robotInit(self): """Robot initiializer. Initializes things such as all of the subsystems and operator input objects. Runs once during startup. """ subsystems.init() operatorinput.init() self.autonomous = Autonomous() print("Initialized robot")
def robotInit(self): ''' This is a good place to set up your subsystems and anything else that you will need to access later. ''' subsystems.init() self.autonomousProgram = AutonomousProgram() ''' Since OI instantiates commands and commands need access to subsystems, OI must be initialized after subsystems. ''' oi.init()
def robotInit(self): ''' This is a good place to set up your subsystems and anything else that you will need to access later. ''' # Command.getRobot = lambda x=0: self # self.motor = singlemotor.SingleMotor() subsystems.init() # self.autonomousProgram = AutonomousProgram() ''' Since OI instantiates commands and commands need access to subsystems, OI must be initialized after subsystems. ''' oi.init()
def robotInit(self): """ This is a good place to set up your subsystems and anything else that you will need to access later. """ subsystems.init() # Command.getRobot = lambda x=0: self # self.motor = singlemotor.SingleMotor() self.autonomousProgram = AutonomousProgram() """ Since OI instantiates commands and commands need access to subsystems, OI must be initialized after subsystems. """ oi.init() self.teleopProgram = FollowJoystick()
def robotInit(self): """Robot initiializer. Initializes things such as all of the subsystems and operator input objects. Runs once during startup. """ subsystems.init() operatorinput.init() self.autonomous = Autonomous() """Launch the child process for obtaining centroids of the vision targets. See the documentation in camera.py and at http://robotpy.readthedocs.io/en/stable/vision/roborio.html""" wpilib.CameraServer.launch('camera.py:main') print("Initialized robot")
def robotInit(self): print('2018Mule - robotInit called') if robotmap.sensors.hasAHRS: try: robotmap.sensors.ahrs = navx.AHRS.create_spi() # use via robotmap.sensors.ahrs.getAngle() print('robotInit: NavX Setup') except: if not DriverStation.getInstance().isFmsAttached(): raise # subsystems must be initialized before things that use them subsystems.init() oi.init() global autoManager autoManager = FakeAutoManager() autoManager.initialize()
def robotInit(self): '''Robot initialization function''' self.map = RobotMap() self.driveMotors = self.createMotors(self.map.CAN.driveMotors) driveTrain.init(self.driveMotors) self.driveStick = wpilib.Joystick( self.map.joystickMap.movementJoystick) ''' This is a good place to set up your subsystems and anything else that you will need to access later. ''' subsystems.init() self.autonomousProgram = autonomous.AutonomousProgram() self.teleopMove = followjoystick.FollowJoystick( self.driveStick.getX, self.driveStick.getY, self.driveStick.getZ)
def robotInit(self): """ We use this method to declare the various, high-level objects for the robot. For example, we can use the create a CommandGroup object to store the various process for our robot to run when we enable it. """ subsystems.init() oi.init() self.teleopProgram = wpilib.command.CommandGroup() self.teleopProgram.addParallel(FollowJoystick()) self.teleopProgram.addParallel(Shooter()) self.autoProgram = wpilib.command.CommandGroup() self.autoProgram.addParallel(AutoJoystick()) self.autoProgram.addParallel(Shooter()) self.autoProgram.addSequential(Crossbow(0.55, 0.5)) self.autoProgram.addSequential(Crossbow(-0.75, 1))
def robotInit(self): subsystems.init() self.autonomousProgram = AutonomousProgram() self.teleopProgram = TankDriveJoystick() oi.init()
def robotInit(self): subsystems.init() self.followJoystick = FollowJoystick()
def robotInit(self): """ WPILIB method on initialization """ # instansiate a getter method so you can do 'import robot; # robot.get_robot()' global get_robot try: wpilib.CameraServer.launch('cameraservant.py:main') except: print("Could not find module cscore") get_robot = self.get_self self.num_loops = 0 subsystems.init() self.autonomousProgram = PulseMotor() self.chooser = wpilib.SendableChooser() #self.chooser.addDefault("SEQUENCE", Sequence()) self.chooser.addObject("Go 1 meter forward", DriveToDistance(1, 1)) self.chooser.addObject("Turn 90 Degrees Clockwise", TurnDrive(90)) # self.chooser.addObject("Turn Arm Horizontal", LiftToProportion(robotmap.measures.ROBOT_ARM_HORIZONTAL)) self.chooser.addObject("Do Nothing Auto", DoNothing(15)) self.chooser.addObject("Grabber(True)", Grabber(True)) self.chooser.addObject("Grabber(False)", Grabber(False)) #self.chooser.addObject("ParametricLine", ParametricDrive(lambda t: .1 * t, lambda t: .4 * t, 5)) # The Auto Line is 10 ft (~3.048 meters) from the start point. May have to be tweaked a bit. self.chooser.addObject("Drive Forward", DriveToDistance(3.048, 3.048)) self.chooser.addObject("Switch Back (inplace)", SwitchBack_inplace()) self.chooser.addObject("COMP: Left", "l") self.chooser.addObject("COMP: Middle", "m") self.chooser.addObject("COMP: Right", "r") self.chooser.addDefault("COMP: Minimal Auto", DriveToDistance(3.048, 3.048)) self.chooser.addObject("COMP: Do Nothing", DoNothing(15)) self.auto_data = None #self.chooser.addObject('PulseMotor', PulseMotor()) wpilib.SmartDashboard.putData('Autonomous Program', self.chooser) self.teleopProgram = wpilib.command.CommandGroup() self.teleopProgram.addParallel(PIDTankDriveJoystick()) #self.teleopProgram.addParallel(TankDriveJoystick()) # self.teleopProgram.addParallel(ArmExtender()) self.teleopProgram.addParallel(ArmRotate()) #self.teleopProgram.addParallel(NavXCommand()) #self.teleopProgram.addParallel(CorrectTip()) oi.init()
def robotInit(self): subsystems.init() oi.init() commands.init()
def robotInit(self): subsystems.init() self.teleopCommand = TankDrive() #self.teleopCommand = MecDrive() self.autonomousCommand = Autonomous()
def robotInit(self): subsystems.init() subsystems.oi.init() self.teleopProgram = NomadDrive() self.autonomousProgram = Auton()
def robotInit(self): subsystems.init() inputs.oi.init() commands.init() print(type(inputs.oi.A))