Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation with limelight #52

Merged
merged 21 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c81e9f4
Changed the Navigation function to use the limelight positions and no…
ShreyasT-1 Feb 4, 2025
9bcb0bc
Changed the Navigation function to use the limelight positions and no…
ShreyasT-1 Feb 4, 2025
b6a099a
Changed the Navigation function to use the limelight positions and no…
ShreyasT-1 Feb 4, 2025
326d02b
added limelight tracking, position need to be updayed
Joshua-Smith-42 Feb 8, 2025
e6acc41
Merge branch 'refs/heads/master' into Navigation_With_Limelight
Joshua-Smith-42 Feb 10, 2025
5722d74
added start in qq opmode
Joshua-Smith-42 Feb 10, 2025
b95bb47
limelight positions
Joshua-Smith-42 Feb 10, 2025
23fb01d
removed redundant autonomous opmodes
Joshua-Smith-42 Feb 10, 2025
f4c7f23
made two specimen tree
Joshua-Smith-42 Feb 10, 2025
a57e989
two specimen auto
Joshua-Smith-42 Feb 10, 2025
30a4013
limelight zeros once per movement to allow for less rerouting during …
Joshua-Smith-42 Feb 10, 2025
fbefd4b
fixed switch config
Joshua-Smith-42 Feb 11, 2025
261c7ed
fixed score arm passive height
Joshua-Smith-42 Feb 11, 2025
6d3853f
score arm stop banging!!
Joshua-Smith-42 Feb 11, 2025
dc202ed
3 specimen auto pushes in 3 samples
Joshua-Smith-42 Feb 12, 2025
8d2a4fd
added min speed back in
Joshua-Smith-42 Feb 12, 2025
84be6b8
added negatives red alliance and other stuffz
Joshua-Smith-42 Feb 14, 2025
991f3fb
messed around with auto posistions
Joshua-Smith-42 Feb 14, 2025
274f3e2
open claw on arm zeroing switch press
Joshua-Smith-42 Feb 15, 2025
dda250b
first working 4 spec
Joshua-Smith-42 Feb 15, 2025
6a00d0f
Changed Positions
Joshua-Smith-42 Feb 15, 2025
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 @@ -18,7 +18,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(55,-102,0);
boolean isDoneDriving = opMode.nav.driveToPositionIN(37,80,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class DriveToIntakePosition extends QQTimeoutNode {
public DriveToIntakePosition(double seconds) {
super(seconds);
}
State lastStatus = State.RUNNING;

@Override
public State tick(DebugTree debug, QQOpMode opMode) {

opMode.telemetry.addData("location",opMode.robot.otos.getOtosPosition());
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(52,47,0,6);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
}
if (hasTimedOut()) {
lastStatus = State.FAILURE;
return State.FAILURE;
}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class DriveToScorePosition extends QQTimeoutNode {
double xPosition;
public DriveToScorePosition(double seconds, double xPosition) {
super(seconds);
this.xPosition = xPosition;
}
State lastStatus = State.RUNNING;

@Override
public State tick(DebugTree debug, QQOpMode opMode) {

opMode.telemetry.addData("location",opMode.robot.otos.getOtosPosition());
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(xPosition,50,0,4);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
}
if (hasTimedOut()) {
lastStatus = State.FAILURE;
return State.FAILURE;
}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class DriveToChamber extends QQTimeoutNode {
public static final double FORWARD_SPEED = 0.3;
public class FirstScore extends QQTimeoutNode {
public static final double FORWARD_SPEED = 0.4;
State lastStatus = State.RUNNING;

public DriveToChamber(double seconds) {
public FirstScore(double seconds) {
super(seconds);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(17,-91,0);
boolean isDoneDriving = opMode.nav.driveToPositionIN(37,50,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
opMode.robot.mecanumDrive.move(INTAKE_SPEED,0,0);
if (opMode.robot.scoringClaw.isClawClosed()){
opMode.robot.mecanumDrive.stop();
opMode.robot.intakeClaw.open();
opMode.robot.intakeArm.goToAutoDropPos();
opMode.robot.intakeClaw.open();;
lastStatus = State.SUCCESS;
return State.SUCCESS;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class MoveForwardForTime extends QQTimeoutNode {
double speed;
State lastStatus = State.RUNNING;
public MoveForwardForTime(double seconds, double speed) {
super(seconds);
this.speed = speed;
}

@Override
public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;}
else {
opMode.robot.mecanumDrive.move(-speed,0,0);
if (hasTimedOut()){
opMode.robot.mecanumDrive.stop();
lastStatus = State.SUCCESS;
return State.SUCCESS;
}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class MoveRightForTime extends QQTimeoutNode {
double speed;
State lastStatus = State.RUNNING;
public MoveRightForTime(double seconds, double speed) {
super(seconds);
this.speed = speed;
}

@Override
public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;}
else {
opMode.robot.mecanumDrive.move(0,speed,0);
if (hasTimedOut()){
opMode.robot.mecanumDrive.stop();
lastStatus = State.SUCCESS;
return State.SUCCESS;

}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(12,-90.5,0);
boolean isDoneDriving = opMode.nav.driveToPositionIN(45,37,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(14,-88,90);
boolean isDoneDriving = opMode.nav.driveToPositionIN(50,80,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class PushSamplesIn extends QQTimeoutNode {
public PushSamplesIn(double seconds) {
super(seconds);
}
State lastStatus = State.RUNNING;

@Override
public State tick(DebugTree debug, QQOpMode opMode) {
opMode.telemetry.addData("location",opMode.robot.otos.getOtosPosition());
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(opMode.robot.otos.getOtosPosition().x, 47,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
}if (hasTimedOut()) {
lastStatus = State.FAILURE;
return State.FAILURE;
}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(14,-88,90);
boolean isDoneDriving = opMode.nav.driveToPositionIN(61.5,85,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class PushThirdSample extends QQTimeoutNode {
public PushThirdSample(double seconds) {
super(seconds);
}
State lastStatus = State.RUNNING;

@Override
public State tick(DebugTree debug, QQOpMode opMode) {

opMode.telemetry.addData("location",opMode.robot.otos.getOtosPosition());
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
boolean isDoneDriving = opMode.nav.driveToPositionIN(59,82,0);
if (isDoneDriving) {
lastStatus = State.SUCCESS;
return State.SUCCESS;
}
if (hasTimedOut()) {
lastStatus = State.FAILURE;
return State.FAILURE;
}
return State.RUNNING;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions;

import com.ftcteams.behaviortrees.DebugTree;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;

public class StandardScore extends QQTimeoutNode {
public static final double FORWARD_SPEED = 0.3;
public static final double RIGHT_SPEED = 0.1;
State lastStatus = State.RUNNING;

public StandardScore(double seconds) {
super(seconds);
}

@Override
public State tick(DebugTree debug, QQOpMode opMode) {
if (lastStatus != State.RUNNING){
return lastStatus;
}else{
if(hasTimedOut()){
opMode.robot.mecanumDrive.stop();
lastStatus = State.FAILURE;
return State.FAILURE;
}
opMode.robot.mecanumDrive.move(FORWARD_SPEED,RIGHT_SPEED,0);
if (opMode.robot.scoringClaw.isClawOpen()){
opMode.robot.mecanumDrive.stop();
lastStatus = State.SUCCESS;
return State.SUCCESS;

}
return State.RUNNING;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Tree TwoSpecimenTree for 16072 generated by http://behaviortrees.ftcteams.com */
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Trees;

import com.ftcteams.behaviortrees.Node;
import com.ftcteams.behaviortrees.Parallel;
import com.ftcteams.behaviortrees.Sequence;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.ArmToIntake;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.ArmToScore;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.DriveToIntakePosition;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.DriveToScorePosition;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.MoveForwardForTime;
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.StandardScore;


public class Cycle {
public static final int TIMEOUT_SECONDS = 10;



public static Node root(double xScorePosition){
return new Sequence(
Intake.root(),
new MoveForwardForTime(.2,-.25),
new Parallel(2,
new DriveToScorePosition(TIMEOUT_SECONDS, xScorePosition),
new ArmToScore(TIMEOUT_SECONDS)),
new StandardScore(TIMEOUT_SECONDS),
new MoveForwardForTime(0.25,1),
new Parallel(2,
new DriveToIntakePosition(TIMEOUT_SECONDS),
new ArmToIntake(TIMEOUT_SECONDS)));

}
}

/* TREE
?
| ->
| | [FisrtScore]
| | [DriveToIntakePosition]
| | [Intake]
| | [DrivetoScorePosition]
| | [StandardScore]
| | [Park]
| [Park]
*/
Loading