Skip to content

Commit

Permalink
Merge pull request ftctechnh#2 from JeremyYao/master
Browse files Browse the repository at this point in the history
10/4 Start AttachmentsInterface,
  • Loading branch information
JeremyYao authored Oct 8, 2017
2 parents cf06c7f + 2ffc867 commit 78fd521
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.firstinspires.ftc.teamcode;

/**
* Created by Jeremy on 10/4/2017.
*/

public interface AttatchmentsInterface
{
void moveLift(double x, double y, boolean leftTrigger, boolean leftBumper);
/*Joystick=fine tuning position of forklift (left,right,slight up and down)
Bumper=Position increases one position upwards
Trigger=Position increases one position downwards
*/
void moveWings(boolean up);
boolean isSeeingRed();
void releaseGrabber(boolean buttonPressed);
String readDiagram();
double[] getAccelerometerValues();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public class TankBase implements TankInterface
private float wheelCircIn = 4 * (float)Math.PI ; //Circumference of wheels used
private float wheelCircCm = (float)(10.16 * Math.PI);

public void init(HardwareMap hMap)
public TankBase(HardwareMap hMap)
{
driveLeftOne = (DcMotorImplEx) hMap.dcMotor.get("driveLeftOne");
driveRightOne = (DcMotorImplEx) hMap.dcMotor.get("driveRightOne");

driveRightOne.setVelocity(3 * Math.PI, AngleUnit.RADIANS); //Neverrest 40 has 160 RPM; 2.6 rev per second
driveRightOne.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
driveLeftOne.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

driveRightOne.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
driveLeftOne.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
resetEncoders();
driveRightOne.setVelocity(3 * Math.PI, AngleUnit.RADIANS);
driveLeftOne.setVelocity(3* Math.PI, AngleUnit.RADIANS);
driveRightOne.setDirection(DcMotorSimple.Direction.FORWARD);
driveLeftOne.setDirection(DcMotorSimple.Direction.FORWARD);

/*
driveRightOne.setDirection(DcMotorSimple.Direction.REVERSE);
driveLeftOne.setDirection(DcMotorSimple.Direction.REVERSE);
Expand Down Expand Up @@ -200,8 +200,10 @@ public void stopAllMotors()

private void resetEncoders()
{
driveRightOne.setMode(DcMotor.RunMode.RESET_ENCODERS);
driveLeftOne.setMode(DcMotor.RunMode.RESET_ENCODERS);
driveRightOne.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
driveLeftOne.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
driveRightOne.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
driveLeftOne.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}

public DcMotorImplEx getDriveLeftOne()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
/**
* Created by Jeremy on 8/27/2017.
*/
@Autonomous(name = "name", group = "concept")
@Autonomous(name = "24in", group = "concept")
public class TestLinearOp extends LinearOpMode
{
private TankBase robot;
@Override
public void runOpMode() throws InterruptedException
{
TankBase robot = new TankBase();
robot.init(hardwareMap);
robot = new TankBase(hardwareMap);
waitForStart();
robot.spin_Left(120);
robot.spin_Right(120);
robot.pivot(120);
robot.driveStraight_In(24);
sleep(5000);
robot.driveStraight_In(-24);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@TeleOp(name = "TankTestTele", group = "Test")
public class TestTeleOp extends OpMode
{
private TankBase tank = new TankBase();
private TankBase tank;

public void init()
{
tank.init(hardwareMap);
tank = new TankBase(hardwareMap);
gamepad1.setJoystickDeadzone(.1f);
gamepad2.setJoystickDeadzone(.1f);
}
Expand All @@ -28,6 +28,7 @@ public void start()

public void loop()
{
telemetry.addData("Expected velcoity ", 3 * Math.PI);
telemetry.addData("Radian Velocity Left", tank.getDriveLeftOne().getVelocity(AngleUnit.RADIANS));
telemetry.addData("radian v right", tank.getDriveRightOne().getVelocity(AngleUnit.RADIANS));
telemetry.addData("LJoyStick= ", gamepad1.left_stick_y);
Expand Down

0 comments on commit 78fd521

Please sign in to comment.