Пример #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 drive objects
     drive.Drive().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(0.05, self._watchdogTimeout)
     self.globalInit()
Пример #2
0
 def robotInit(self):
     """Run when the robot turns on"""
     # Update constants from json file on robot
     Constants.updateConstants()
     # Robot odemetry command
     self.updateodemetry = updateodemetry.UpdateOdemetry()
     # Set command group member variables
     self.autonomous = autogroup.AutonomousCommandGroup()
     self.disabled = disabledgroup.DisabledCommandGroup()
     self.teleop = teleopgroup.TeleopCommandGroup()
     self.test = testgroup.TestCommandGroup()
Пример #3
0
 def robotInit(self):
     Command.getRobot = lambda x=0: self
     """Run when the robot turns on."""
     # Update constants from json file on robot
     if self.isReal():
         Constants.updateConstants()
     # Initialize drive objects
     drive.Drive().init()
     # The PDP
     self.pdp = PDP(Constants.PDP_ID)
     # Robot odemetry command
     self.updateodemetry = updateodemetry.UpdateOdemetry()
     # 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()
     # Start the camera sever
     CameraServer.launch()
Пример #4
0
 def robotInit(self):
     """Run when the robot turns on."""
     field_styles = coloredlogs.DEFAULT_FIELD_STYLES
     field_styles['filename'] = {'color': 'cyan'}
     coloredlogs.install(
         level='WARN',
         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()
     longarm.LongArm().init()
     shortarm.ShortArm().init()
     intake.Intake().init()
     climbroller.ClimbRoller().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)
     self.watchdog = watchdog.Watchdog(Constants.WATCHDOG_TIMEOUT,
                                       self._watchdogTimeout)
     self.globalInit()
     LiveWindow.disableAllTelemetry()