def __init__(self, physics_controller): ''' :param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to ''' self.physics_controller = physics_controller self.drivetrain = drivetrains.FourMotorDrivetrain()
def __init__(self, physics_controller): """ :param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to """ self.fl_encoder = self.fr_encoder = self.rl_encoder = self.rr_encoder = 0 self.physics_controller = physics_controller """ # Change these parameters to fit your robot! """ # Create a lift simulation self.lift_motion = motion.LinearMotion("Lift", 6, 360) self.mecaum_drivetrain = drivetrains.MecanumDrivetrain(x_wheelbase=2, y_wheelbase=2, speed=5) self.tank_drivetrain = drivetrains.FourMotorDrivetrain(x_wheelbase=2, speed=5) self.physics_controller.add_device_gyro_channel("navxmxp_spi_4_angle")
def __init__(self, physics_controller): self.physics_controller = physics_controller self.drive = drivetrains.FourMotorDrivetrain()
def __init__(self, controller): self.controller = controller self.drivetrain = self.drivetrain = drivetrains.FourMotorDrivetrain( deadzone=drivetrains.linear_deadzone(0.05)) self.deadZone = 0.05
def test_four_motor_drivetrain(lf_motor, lr_motor, rf_motor, rr_motor, output): result = drivetrains.FourMotorDrivetrain(speed=1 * units.fps).calculate( lf_motor, lr_motor, rf_motor, rr_motor) result = (result.vx_fps, result.omega) assert abs(result[0] - output[0]) < 0.001 assert abs(result[1] - output[1]) < 0.001