Beispiel #1
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     speed = self._speed
     time_left = self._duration - self._stopwatch.elapsed_time_in_secs()
     if (time_left < self._ramp_threshold):
         speed = speed * time_left / self._ramp_threshold
     self.robot.drivetrain.arcade_drive(speed, 0.0)
     return Command.execute(self)
Beispiel #2
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     dpad_y = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.DPADY)
     if dpad_y != 0.0:
         self.robot.drivetrain.arcade_drive(self.DPAD_LINEAR_SPEED * dpad_y, 0.0)
     else:
         left_track = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.LEFTY)
         right_track = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.RIGHTY)
         self.robot.drivetrain.tankDrive(left_track, right_track)
     return Command.execute(self)
Beispiel #3
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     current = self.robot.drivetrain.get_gyro_angle()
     degrees_left = self._target_degrees - current
     if degrees_left >= 0:
         direction = 1.0
     else:
         direction = -1.0
     turn_speed = self._speed * direction
     # Set drivetrain using speed and direction
     self.robot.drivetrain.arcade_drive(0.0, turn_speed, False)
     return Command.execute(self)
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     current = self.robot.drivetrain.get_gyro_angle()
     degrees_left = self._target_degrees - current
     if (degrees_left) >= 0:
         direction = 1.0
     else:
         direction = -1.0
     turn_speed = self._speed * direction
     if degrees_left < self._ramp_threshold:
         turn_speed = turn_speed * (degrees_left) / self._ramp_threshold
     # Set drivetrain using speed and direction
     self.robot.drivetrain.arcade_drive(0.0, turn_speed)
     return Command.execute(self)
Beispiel #5
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     modifier = self.robot.oi.get_button_state(UserController.DRIVER, JoystickButtons.RIGHTTRIGGER)
     dpad_y = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.DPADY)
     if dpad_y != 0.0:
         self.robot.drivetrain.arcade_drive(self._dpad_scaling * dpad_y, 0.0)
     else:
         left_track = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.LEFTY)
         right_track = self.robot.oi.get_axis(UserController.DRIVER, JoystickAxis.RIGHTY)
         if modifier:
             self.robot.drivetrain.tank_drive(self._stick_scaling * left_track, self._stick_scaling * right_track)
         else:
             self.robot.drivetrain.tank_drive(left_track, right_track)
     return Command.execute(self)
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     # Get encoder count
     current = self.robot.drivetrain.get_encoder_value()
     distance_left = self._target_position - current
     # Determine direction using target and current encoder values
     if distance_left >= 0:
         direction = -1.0
     else:
         direction = 1.0
     linear_drive_amount = self._speed * direction
     # Set drivetrain using speed and direction
     self.robot.drivetrain.arcade_drive(linear_drive_amount, 0.0, False)
     return Command.execute(self)
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     # Get encoder count
     current = self.robot.drivetrain.get_encoder_value()
     distance_left = self._target_position - current
     # Determine direction using target and current encoder values
     if (distance_left) >= 0:
         direction = 1.0
     else:
         direction = -1.0
     linear_drive_amount = self._speed * direction
     if (distance_left < self._ramp_threshold):
         linear_drive_amount = linear_drive_amount * (distance_left) / self._ramp_threshold
     # Set drivetrain using speed and direction
     self.robot.drivetrain.arcade_drive(linear_drive_amount, 0.0)
     return Command.execute(self)
Beispiel #8
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     return Command.execute(self)
Beispiel #9
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     return Command.execute(self)
Beispiel #10
0
 def execute(self):
     """Called repeatedly when this Command is scheduled to run"""
     speed = self._speed
     self.robot.drivetrain.arcade_drive(speed, 0.0, False)
     return Command.execute(self)