Last active
March 28, 2017 22:05
-
-
Save calebeby/b6daca87758c5beda7e4b781cbb70be5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wpilib | |
from magicbot import magic_motion_profile | |
class Drive(magic_motion_profile): | |
robot_drive = wpilib.RobotDrive | |
left_drive_motor = wpilib.Spark | |
right_drive_motor = wpilib.Spark | |
rotation_speed = resetsTo(0) | |
forwards_speed = resetsTo(0) | |
def __init__(self): | |
self.set_profile_forwards(max_feet_per_second=8, acceleration_seconds=1.5, deceleration_seconds=1) | |
self.set_profile_rotation(max_degrees_per_second=90, acceleration_seconds=0.5, deceleration_seconds=0.5) | |
def execute(self): | |
self.robot_drive.arcadeDrive(self.forwards, self.rotation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from components import drive | |
from robotpy_ext.autonomous import state, StatefulAutonomous | |
import wpilib | |
from magicbot.magic_tunable import tunable | |
class sideLift(StatefulAutonomous): | |
MODE_NAME = "Side Lift" | |
DEFAULT = False | |
drive = drive.Drive | |
camera = camera.Camera | |
@state(first=True) | |
def forward(self): | |
if self.drive.forwards(feet=3): | |
self.next_state('turn') | |
@state | |
def turn(self): | |
if self.drive.turn_right(degrees=60): | |
self.next_state('forward_to_airship') | |
@state | |
def forward_to_airship(self): | |
self.drive.forwards(feet=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment