Пример #1
0
    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))
Пример #2
0
    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()
Пример #3
0
    def robotInit(self):
        subsystems.init()

        oi.init()
        self.teleopProgram = wpilib.command.CommandGroup()
        self.teleopProgram.addParallel(FollowJoystick())
        self.teleopProgram.addParallel(Intake())
Пример #4
0
 def robotInit(self):
     """
 This function is run when the robot is first started up and should be 
 used for any initialization code.
 """
     self.compressor = Compressor()
     self.compressor.setClosedLoopControl(True)
     robotsubsystems.init()
     oi.init()
Пример #5
0
    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()
Пример #6
0
    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()
Пример #7
0
    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()
Пример #8
0
    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()
Пример #9
0
    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))
Пример #10
0
    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()
Пример #11
0
    def robotInit(self):
        subsystems.init()
        self.autonomousProgram = AutonomousProgram()
        self.teleopProgram = TankDriveJoystick()

        oi.init()