Exemple #1
0
 def robotInit(self):
     """Run when the robot turns on."""
     field_styles = coloredlogs.DEFAULT_FIELD_STYLES
     field_styles['filename'] = {'color': 'cyan'}
     coloredlogs.install(
         fmt=
         "%(asctime)s[%(msecs)d] %(filename)s:%(lineno)d %(name)s %(levelname)s %(message)s",
         datefmt="%m-%d %H:%M:%S",
         field_styles=field_styles)  # install to created handler
     Command.getRobot = lambda x=0: self
     # Update constants from json file on robot
     # if self.isReal():
     #     Constants.updateConstants()
     # Update constants for dashboard editing
     Constants.initSmartDashboard()
     # Initialize motor objects
     drive.Drive().init()
     backarm.BackArm().init()
     intake.Intake().init()
     # The PDP
     # self.pdp = PDP(7)
     # Set command group member variables
     self.autonomous = autogroup.AutonomousCommandGroup()
     self.disabled = disabledgroup.DisabledCommandGroup()
     self.disabled.setRunWhenDisabled(True)
     self.teleop = teleopgroup.TeleopCommandGroup()
     self.test = testgroup.TestCommandGroup()
     self.global_ = globalgroup.GlobalCommandGroup()
     self.global_.setRunWhenDisabled(True)
     # Start the camera sever
     CameraServer.launch()
     self.watchdog = watchdog.Watchdog(Constants.WATCHDOG_TIMEOUT,
                                       self._watchdogTimeout)
     self.globalInit()
     LiveWindow.disableAllTelemetry()
Exemple #2
0
    def robotInit(self):
        self.drivetrain = drivetrain.Drivetrain(self)
        self.intake = intake.Intake(self)
        self.lift = lift.Lift(self)

        self.oi = OI(self)

        self.logger = logging.getLogger("robot")

        self.autonomousCommand = None

        wpilib.CameraServer.launch('vision.py:main')

        self.chooser = wpilib.SendableChooser()
        self.chooser.addObject("Left", 1)
        self.chooser.addDefault("Center", 2)
        self.chooser.addObject("Right", 3)

        wpilib.SmartDashboard.putData("Auto Chooser", self.chooser)
Exemple #3
0
    def __init__(self):
        """Initilize the Odemetry class."""
        super().__init__()
        self.drive = drive.Drive()
        self.timestamp = 0
        self.last_timestamp = 0
        self.dt = 0

        # Gyroscope
        if hal.isSimulation():
            self.gyro = analoggyro.AnalogGyro(0)
            self.pidgyro = pidanaloggyro.PIDAnalogGyro(self.gyro)
        else:
            self.gyro = PigeonIMU(intake.Intake().l_motor)
            self.pidgyro = pidpigeon.PIDPigeon(self.gyro)

        self.pose = pose.Pose()

        self.last_left_encoder_distance = 0
        self.last_right_encoder_distance = 0
        self.last_angle = 0
Exemple #4
0
  def robotInit(self):
    """
    Init Robot
    """

    # Robot Components
    # Constructor params are PWM Ports on the RIO
    self.drivetrain = drive.Drivetrain(self, 1,2,3,4)
    self.intake = intake.Intake(0, self)
    self.popper = popper.Popper(0,0)
    
    self.front_lift = lift.Lift(0,1,2)
    self.rear_lift = lift.Lift(0,5,4)
    
    self.imu = imu.IMU(2)
    self.encoders = encoders.Encoders()

    CameraServer.launch("subsystems/camera.py:main")
    self.oi = OI(self) 

    
    #self.drivecommand = DriveCommandGroup()
    
    self.timer = Timer()
 def __init__(self, state):
     super().__init__()
     self.intake = intake.Intake()
     self.requires(self.intake)
     self.state = state
     self.setInterruptible(True)