Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Head #277

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Head #277

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dbadf83
Update README.md
TSTEMTrilobytesSoftware Sep 4, 2019
cb812dd
Update README.md
TSTEMTrilobytesSoftware Sep 4, 2019
f1501b3
Update README.md
fernandesi2244 Sep 4, 2019
22ce18c
Add test Operational Mode to TeamCode folder.
fernandesi2244 Sep 4, 2019
512a5ed
Merge remote-tracking branch 'origin/master'
fernandesi2244 Sep 4, 2019
7e37940
test one
sgutierrez8c54 Oct 17, 2019
2da9904
messing around.
sgutierrez8c54 Oct 17, 2019
63dc8aa
Cleopatra.
sgutierrez8c54 Oct 19, 2019
de417fb
Cleopatra hardware definition.
sgutierrez8c54 Oct 20, 2019
63cfc81
Cleopatra Hardware update made it public.
sgutierrez8c54 Oct 20, 2019
48800b4
Cleopatra Hardware update made it public.
sgutierrez8c54 Oct 20, 2019
0ab2045
Merge branch 'master' of https://github.com/TSTEMTrilobytesSoftware/F…
sgutierrez8c54 Oct 20, 2019
f9e26ab
Cleopatra Hardware update made it public.
sgutierrez8c54 Oct 20, 2019
1fbcf51
Cleopatra Hardware update made it public.
sgutierrez8c54 Oct 21, 2019
7695836
CleopatraHardware/HCleopatra12820TeleOp update
sgutierrez8c54 Oct 21, 2019
e7d1da1
CleopatraHardware/HCleopatra12820TeleOp update
sgutierrez8c54 Oct 21, 2019
3d9dee4
CleopatraHardware/HCleopatra12820TeleOp update
sgutierrez8c54 Oct 22, 2019
5d5c396
CleopatraHardware/HCleopatra12820TeleOp update
sgutierrez8c54 Oct 22, 2019
cd95cdf
CleopatraHardware/HCleopatra12820TeleOp update
sgutierrez8c54 Oct 22, 2019
a47c832
added methods to setup intake servos.
sgutierrez8c54 Oct 23, 2019
c9dc7bb
Fixed methods to setup intake servos.
sgutierrez8c54 Oct 23, 2019
c89db0b
Changed direction front right wheel.
sgutierrez8c54 Oct 23, 2019
458c250
Starting SkyStone Navigation webcam.
sgutierrez8c54 Oct 30, 2019
ba670a6
Starting SkyStone Navigation no webcam.
sgutierrez8c54 Oct 30, 2019
f133e6c
SkyStone Navigation with webcam.
sgutierrez8c54 Nov 8, 2019
fe26a62
After retrieval.
sgutierrez8c54 May 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class ConceptVuMarkIdentificationWebcam extends LinearOpMode {
/*
* Retrieve the camera we are to use.
*/
webcamName = hardwareMap.get(WebcamName.class, "Webcam 1");
webcamName = hardwareMap.get(WebcamName.class, "Webcam");

/*
* To start up Vuforia, tell it the view that we wish to use for camera monitor (on the RC phone);
Expand All @@ -115,7 +115,7 @@ public class ConceptVuMarkIdentificationWebcam extends LinearOpMode {
* Once you've obtained a license key, copy the string from the Vuforia web site
* and paste it in to your code on the next line, between the double quotes.
*/
parameters.vuforiaLicenseKey = " -- YOUR NEW VUFORIA KEY GOES HERE --- ";
parameters.vuforiaLicenseKey = "AZ7AcNj/////AAABmdKSAUs6jUbsp930wtIqmTIRxjvnBoJicMSGMSRBRbhQXiAWgOguLnfnmd4VY/dCrYjng3gsv1I5Ay+eqb/l35mf6A2IuMtk67j2418iymTvTLGolY0+WhbIGrOwoF8GEjnqqn0fGDSZQGJbrpIKvNvDyj87SiV7cqDvtpyKzU8IqmlPzxSq8S5+opn6ai7Rl3w6P/uDSIThMYNi9Eb/BelfNf/OjToOO5JXqx4muxjz8wJbGSIC++GYHjoPPn+oPSEvHEKaLMIy43JsTMC1lilc8XK2JBnUjQf+b7rmphbz8kMwI6Kr6rv/ubUkvwIor2lBKw7SPeGIawSWBoVdVncDgyUylbWBmh5RHIx1g2nX";


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public class ConceptVuforiaNavigationWebcam extends LinearOpMode {
* Once you've obtained a license key, copy the string from the Vuforia web site
* and paste it in to your code on the next line, between the double quotes.
*/
parameters.vuforiaLicenseKey = " -- YOUR NEW VUFORIA KEY GOES HERE --- ";
parameters.vuforiaLicenseKey = "Abhg0uD/////AAABmY26d2nlY0Hmptt0cQ/Ros4OL3zWSe0yB6zr8WuTqEvE/K9IgpgHArL+IxI5hb23LlUKkh5sx6XPbxX+Z6yg/jAIlHKYPrLqVgM8efHoio7dx5E8EfTyNmNaa83pY4beZ4MySDc3lB7CXjoScgP1+pVEujlo1nGp3nx61E3oVegAymgyZdfAtIjJgs8/OmeXKDXxOaYZcSN/ww99IkGFwSIA02mX8pdIUXr0DtCVKLsqq5v4sNoRsc4udSDr+Y+3eyDuMGCQDlHoiN5yPHyPiIBG1Urko8/Pnq1fl9VmBVg6l/pRJ2H6KfyNmFnt2ceoFIAFopWuV8Tc8VaSKC5n95PjYda6pOpbH8jQjMr/sEns";

/**
* We also indicate which camera on the RC we wish to use.
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## NOTICE
# FTC-Skystone-2019-2020-Programming

This repository contains the public FTC SDK for the SKYSTONE (2019-2020) competition season.
Welcome!

Formerly this software project was hosted [here](https://github.com/ftctechnh/ftc_app). Teams who are competing in the SKYSTONE Challenge should use this [new SKYSTONE repository](https://github.com/FIRST-Tech-Challenge/SKYSTONE) instead of the older (and no longer updated) ftc_app repository.
This module, TeamCode, is the place where our team has wrote the code for our robot controller app for the FTC Rover Ruckus season.

Programmers: Read the issue in the Issues tab. This is where you can assign different team members to do different things.

Software Team: Ian Fernandes, Melissa Fusco, and Bella Gonzalez

## Welcome!
This GitHub repository contains the source code that is used to build an Android app to control a *FIRST* Tech Challenge competition robot. To use this SDK, download/clone the entire project to your local computer.

## Getting Started
If you are new to robotics or new to the *FIRST* Tech Challenge, then you should consider reviewing the [FTC Blocks Tutorial](https://github.com/FIRST-Tech-Challenge/SKYSTONE/wiki/Blocks-Tutorial) to get familiar with how to use the control system:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
/* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;


/**
Tinoco's starting working code, I named the robot Cleopatra.
*/

@TeleOp(name="Basic: Linear OpMode for 1019-2020 Season", group="Linear Opmode")
//@Disabled
public class Cleopatra12820TeleOp extends LinearOpMode {


// public static final double INCREMENT=0.01; // amount to slew servo each CYCLE_MS cycle
public static final int CYCLE_MS = 50; // period of each cycle
public static final double MID_SERVO = 0.5;

// Declare OpMode members.
private ElapsedTime runtime = new ElapsedTime();
double position = MID_SERVO;// Start at halfway position

DcMotor backMotorLeft = null;
DcMotor backMotorRight = null;
DcMotor frontMotorLeft = null;
DcMotor frontMotorRight = null;
DcMotor armElbow = null;
DcMotor armWrist = null;
Servo claw = null;
Servo gripperLeft=null;
Servo gripperRight=null;


@Override
public void runOpMode() {

telemetry.addData("Status", "Initialized");
telemetry.update();



/* Initialize the hardware variables. Note that the strings used here as parameters
to 'get' must correspond to the names assigned during the robot configuration
step (using the FTC Robot Controller app on the phone).*/



backMotorLeft = hardwareMap.get(DcMotor.class, "backMotorLeft");
backMotorRight = hardwareMap.get(DcMotor.class, "backMotorRight");
frontMotorLeft = hardwareMap.get(DcMotor.class, "frontMotorLeft");
frontMotorRight = hardwareMap.get(DcMotor.class, "frontMotorRight");
armElbow = hardwareMap.get(DcMotor.class, "armElbow");
armWrist = hardwareMap.get(DcMotor.class, "armWrist");

claw = hardwareMap.get(Servo.class, "claw");
gripperLeft = hardwareMap.get(Servo.class, "gripperLeft");
gripperRight = hardwareMap.get(Servo.class, "gripperRight");




// Most robots need the motor on one side to be reversed to drive forward
// Reverse the motor that runs backwards when connected directly to the battery
armElbow.setDirection(DcMotor.Direction.FORWARD);
armWrist.setDirection(DcMotor.Direction.REVERSE);

backMotorLeft.setDirection(DcMotor.Direction.FORWARD);
backMotorRight.setDirection(DcMotor.Direction.REVERSE);
frontMotorLeft.setDirection(DcMotor.Direction.REVERSE); //I CHANGED THIS ONE ALSO
frontMotorRight.setDirection(DcMotor.Direction.FORWARD); //THIS IS THE ONE I CHANGED

claw.setDirection(Servo.Direction.FORWARD);
gripperRight.setDirection(Servo.Direction.FORWARD);
gripperLeft.setDirection(Servo.Direction.REVERSE);


// Wait for the game to start (driver presses PLAY)
waitForStart();
runtime.reset();

// run until the end of the match (driver presses STOP)
while (opModeIsActive()) {

// Setup a variable for each drive wheel to save power level for telemetry

double Speed = -gamepad1.left_stick_y;
double Turn = gamepad1.left_stick_x;
double Strafe = gamepad1.right_stick_x;


//telemetry.addData("Right Servo position", intakeServoRight.getPosition());
//telemetry.update();

/*
Front Left= +Speed + Turn - Strafe Front Right= +Speed - Turn + Strafe
Back Left = +Speed + Turn + Strafe Back Right = +Speed - Turn - Strafe
*/
double numFl = Range.clip((+Speed + Turn - Strafe), -1, +1);
double numBl = Range.clip((+Speed + Turn + Strafe), -1, 1);
double numFr = Range.clip((+Speed - Turn + Strafe), -1, +1);
double numBr = Range.clip((+Speed - Turn - Strafe), -1, 1);
double armElbowPower = Range.clip(0.5*gamepad2.left_stick_y, -1, 1);
double armWristPower = Range.clip(2 *gamepad2.right_stick_y, -1, 1);

armWrist.setPower(armWristPower);
armElbow.setPower(armElbowPower);
frontMotorLeft.setPower(numFl);
if (backMotorLeft != null)
backMotorLeft.setPower(numBl);

frontMotorRight.setPower(numFr);
if (backMotorRight != null)
backMotorRight.setPower(numBr);



//Use gamepad2 left & right Bumpers to open and close the claw
if (gamepad2.right_bumper) {
claw.setPosition(-1);
} else if (gamepad2.left_bumper) {
claw.setPosition(1);
}

if(gamepad2.x){
gripperRight.setPosition(-1);
gripperLeft.setPosition(-1);
}else if(gamepad2.y){
gripperRight.setPosition(1);
gripperLeft.setPosition(1);

}
sleep(CYCLE_MS);
idle();

// Show the elapsed game time and wheel power.
telemetry.addData("Status", "Run Time: " + runtime.toString());
//telemetry.addData("Motors", "left (%.2f), right (%.2f)", intakeLeftPower, intakeRightPower);
telemetry.update();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

/**
* This is NOT an opmode.
*
* This class can be used to define all the specific hardware for a single robot.
* In this case that robot is a Pushbot.
* See PushbotTeleopTank_Iterative and others classes starting with "Pushbot" for usage examples.
*
* This hardware class assumes the following device names have been configured on the robot:
* Note: All names are lower case and some have single spaces between words.
*
* Motor channel: Left drive motor: "left_drive"
* Motor channel: Right drive motor: "right_drive"
* Motor channel: Manipulator drive motor: "left_arm"
* Servo channel: Servo to open left claw: "left_hand"
* Servo channel: Servo to open right claw: "right_hand"
*/
public class CleopatraHardware
{
/* Public OpMode members. */
public DcMotor intakeMotorLeft=null;
public DcMotor intakeMotorRight=null;
public DcMotor backMotorLeft=null;
public DcMotor backMotorRight=null;
public DcMotor frontMotorLeft=null;
public DcMotor frontMotorRight=null;
public DcMotor armElbow=null;
public DcMotor armWrist=null;
public Servo intakeServoRight=null;
public Servo intakeServoLeft=null;
public Servo claw=null;
public Servo rotator=null;

public static final double MID_SERVO = 0.5 ;
public static final double ARM_UP_POWER = 0.45 ;
public static final double ARM_DOWN_POWER = -0.45 ;
public static final double ELBOW_UP_POWER = 0.45 ;
public static final double ELBOW_DOWN_POWER = -0.45 ;

/* local OpMode members. */
HardwareMap hwMap = null;
private ElapsedTime period = new ElapsedTime();

/* Constructor */
public CleopatraHardware(){

}

/* Initialize standard Hardware interfaces */
public void init(HardwareMap ahwMap) {
// Save reference to Hardware map
hwMap = ahwMap;

// Define and Initialize Motors
intakeMotorLeft = hwMap.get(DcMotor.class, "intakeMotorLeft");
intakeMotorRight = hwMap.get(DcMotor.class, "intakeMotorRight");
backMotorLeft = hwMap.get(DcMotor.class, "backMotorLeft");
backMotorRight = hwMap.get(DcMotor.class, "backMotorRight");
frontMotorLeft = hwMap.get(DcMotor.class, "frontMotorLeft");
frontMotorRight = hwMap.get(DcMotor.class, "frontMotorRight");
armElbow = hwMap.get(DcMotor.class,"armElbow");
armWrist = hwMap.get(DcMotor.class, "armWrist");
intakeServoRight = hwMap.get(Servo.class, "intakeServoRight");
intakeServoLeft = hwMap.get(Servo.class, "intakeServoLeft");
claw = hwMap.get(Servo.class, "claw");
rotator=hwMap.get(Servo.class, "rotator");


armElbow.setDirection(DcMotor.Direction.FORWARD);
armWrist.setDirection(DcMotor.Direction.REVERSE);
intakeMotorLeft.setDirection(DcMotor.Direction.REVERSE);
intakeMotorRight.setDirection(DcMotor.Direction.FORWARD);
backMotorLeft.setDirection(DcMotor.Direction.FORWARD);
backMotorRight.setDirection(DcMotor.Direction.REVERSE);
frontMotorLeft.setDirection(DcMotor.Direction.FORWARD);
frontMotorRight.setDirection(DcMotor.Direction.REVERSE);
claw.setDirection(Servo.Direction.FORWARD);
intakeServoRight.setDirection(Servo.Direction.FORWARD);
intakeServoLeft.setDirection(Servo.Direction.REVERSE);
rotator.setDirection(Servo.Direction.FORWARD);

// Set all motors to zero power

armElbow.setPower(0);
armWrist.setPower(0);
intakeMotorLeft.setPower(0);
intakeMotorRight.setPower(0);
backMotorLeft.setPower(0);
backMotorRight.setPower(0);
frontMotorLeft.setPower(0);
frontMotorRight.setPower(0);


// Set all motors to run without encoders.
// May want to use RUN_USING_ENCODERS if encoders are installed.
armElbow.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
armWrist.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
intakeMotorLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
intakeMotorRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
backMotorLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
backMotorRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
frontMotorLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
frontMotorRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);

// Define and initialize ALL installed servos.
claw = hwMap.get(Servo.class, "claw");
intakeServoLeft = hwMap.get(Servo.class, "intakeServoLeft");
intakeServoRight= hwMap.get(Servo.class, "intakeServoRight");
rotator=hwMap.get(Servo.class, "rotator");
claw.setPosition(MID_SERVO);
intakeServoLeft.setPosition(MID_SERVO);
intakeServoRight.setPosition(MID_SERVO);
rotator.setPosition(MID_SERVO);
}
}

Loading