jgghdfn
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot.commands;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.Gratte;
|
||||
|
||||
@ -26,16 +27,16 @@ public class GratteBaisser extends CommandBase {
|
||||
@Override
|
||||
public void execute() {
|
||||
if(gratte.basd()){
|
||||
gratte.baiser(0);
|
||||
gratte.baiserd(0);
|
||||
}
|
||||
else{
|
||||
gratte.baiser(0.5);
|
||||
gratte.baiserd(0.5);
|
||||
}
|
||||
if(gratte.basg()){
|
||||
gratte.baiser(0);
|
||||
gratte.baiserg(0);
|
||||
}
|
||||
else{
|
||||
gratte.baiser(0.5);
|
||||
gratte.baiserg(0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +44,10 @@ public class GratteBaisser extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
gratte.baiserd(0);
|
||||
gratte.baiserg(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@
|
||||
package frc.robot.commands;
|
||||
|
||||
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.Gratte;
|
||||
|
||||
@ -27,22 +28,25 @@ public class GratteMonte extends CommandBase {
|
||||
@Override
|
||||
public void execute() {
|
||||
if(gratte.hautd()){
|
||||
gratte.Lever(0.5);
|
||||
gratte.Leverd(0);
|
||||
}
|
||||
else{
|
||||
gratte.Lever(0.5);
|
||||
gratte.Leverd(0.5);
|
||||
}
|
||||
if(gratte.hautg()) {
|
||||
gratte.Lever(0.5);
|
||||
gratte.Leverg(0);
|
||||
}
|
||||
else{
|
||||
gratte.Lever(0.5);
|
||||
gratte.Leverg(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
gratte.Leverd(0);
|
||||
gratte.Leverg(0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
@ -10,12 +10,9 @@ import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.BasePilotable;
|
||||
|
||||
public class Gyro extends CommandBase {
|
||||
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
||||
private BasePilotable basePilotable;
|
||||
/** Creates a new Gyro. */
|
||||
public Gyro(BasePilotable basePilotable) {
|
||||
teb.add("angleGyro", 0.1);
|
||||
teb.add("vitesseGyro", 0.1);
|
||||
this.basePilotable = basePilotable;
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
addRequirements(basePilotable);
|
||||
@ -28,18 +25,13 @@ public class Gyro extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(basePilotable.getpitch()>10)
|
||||
if(basePilotable.getpitch()>6)
|
||||
{
|
||||
basePilotable.drive(0.3*basePilotable.getpitch()/12, 0);
|
||||
}
|
||||
else if(basePilotable.getpitch()<-10)
|
||||
else if(basePilotable.getpitch()<-6)
|
||||
{
|
||||
basePilotable.drive(0.3*basePilotable.getpitch()/12, 0);
|
||||
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
||||
}
|
||||
else if(basePilotable.getpitch()<-4)
|
||||
{
|
||||
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
37
src/main/java/frc/robot/commands/bras/BrasManuel.java
Normal file
37
src/main/java/frc/robot/commands/bras/BrasManuel.java
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot.commands.bras;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||
|
||||
public class BrasManuel extends CommandBase {
|
||||
private BrasTelescopique brasTelescopique;
|
||||
/** Creates a new BrasManuel. */
|
||||
public BrasManuel(BrasTelescopique brasTelescopique) {
|
||||
this.brasTelescopique = brasTelescopique;
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
brasTelescopique.AvanceRecule(0.3);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -22,38 +22,37 @@ public class PivotBrasRentre extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()>1){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
if (pivot.distance()>1){
|
||||
pivot.monteDescendre(0.5);
|
||||
}
|
||||
else if(brasTelescopique.photocell()){
|
||||
if(brasTelescopique.photocell()){
|
||||
brasTelescopique.ouvrir();
|
||||
brasTelescopique.Reset();
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
else{
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
}
|
||||
if(pivot.limitpivot()){
|
||||
if(pivot.limitpivot()){
|
||||
pivot.Reset();
|
||||
pivot.monteDescendre(0);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0.5);
|
||||
pivot.monteDescendre(-0.3);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
@ -22,27 +22,29 @@ public class PivotChercheBas extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()<10){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
if(brasTelescopique.distance()>-17.5){
|
||||
brasTelescopique.AvanceRecule(-0.2);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
else if(brasTelescopique.distance()>11) {
|
||||
brasTelescopique.AvanceRecule(-0.5);
|
||||
else if(brasTelescopique.distance()<-19.5) {
|
||||
brasTelescopique.AvanceRecule(0.2);
|
||||
}
|
||||
else {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
if (pivot.distance()<10){
|
||||
pivot.monteDescendre(0.5);
|
||||
if (pivot.distance()<8.5){
|
||||
pivot.monteDescendre(0.3);
|
||||
}
|
||||
else if(pivot.distance()>11) {
|
||||
pivot.monteDescendre(-0.5);
|
||||
else if(pivot.distance()>10.5) {
|
||||
pivot.monteDescendre(-0.3);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0);
|
||||
@ -51,7 +53,11 @@ public class PivotChercheBas extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
@ -22,27 +22,26 @@ public class PivotChercheHaut extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()<10){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
else if(brasTelescopique.distance()>11) {
|
||||
brasTelescopique.AvanceRecule(-0.5);
|
||||
}
|
||||
else {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
if(brasTelescopique.photocell()){
|
||||
brasTelescopique.ouvrir();
|
||||
brasTelescopique.Reset();
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
}
|
||||
else{
|
||||
brasTelescopique.AvanceRecule(0.3);
|
||||
}
|
||||
if (pivot.distance()<10){
|
||||
pivot.monteDescendre(0.5);
|
||||
if (pivot.distance()<43.5){
|
||||
pivot.monteDescendre(0.4);
|
||||
}
|
||||
else if(pivot.distance()>11) {
|
||||
pivot.monteDescendre(-0.5);
|
||||
else if(pivot.distance()>44.5) {
|
||||
pivot.monteDescendre(-0.4);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0);
|
||||
@ -51,7 +50,11 @@ public class PivotChercheHaut extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
38
src/main/java/frc/robot/commands/bras/PivotManuel.java
Normal file
38
src/main/java/frc/robot/commands/bras/PivotManuel.java
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot.commands.bras;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc.robot.subsystems.bras.Pivot;
|
||||
|
||||
public class PivotManuel extends CommandBase {
|
||||
private Pivot pivot;
|
||||
/** Creates a new PivotManuel. */
|
||||
public PivotManuel(Pivot pivot) {
|
||||
this.pivot = pivot;
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
addRequirements(pivot);
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
pivot.monteDescendre(0.3);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -24,27 +24,29 @@ public class PivoteBrasBas extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()<10){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
if(brasTelescopique.distance()>-13.5){
|
||||
brasTelescopique.AvanceRecule(-0.2);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
else if(brasTelescopique.distance()>11) {
|
||||
brasTelescopique.AvanceRecule(-0.5);
|
||||
else if(brasTelescopique.distance()<-15.5) {
|
||||
brasTelescopique.AvanceRecule(0.2);
|
||||
}
|
||||
else {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
if (pivot.distance()<10){
|
||||
pivot.monteDescendre(0.5);
|
||||
if (pivot.distance()<8.5){
|
||||
pivot.monteDescendre(0.3);
|
||||
}
|
||||
else if(pivot.distance()>11) {
|
||||
pivot.monteDescendre(-0.5);
|
||||
else if(pivot.distance()>10.5) {
|
||||
pivot.monteDescendre(-0.3);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0);
|
||||
@ -55,7 +57,11 @@ public class PivoteBrasBas extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
|
@ -22,27 +22,29 @@ public class PivoteBrasHaut extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()<10){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
if(brasTelescopique.distance()>-39.5){
|
||||
brasTelescopique.AvanceRecule(-0.15);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
else if(brasTelescopique.distance()>11) {
|
||||
brasTelescopique.AvanceRecule(-0.5);
|
||||
else if(brasTelescopique.distance()<41.5) {
|
||||
brasTelescopique.AvanceRecule(-0.15);
|
||||
}
|
||||
else {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
if (pivot.distance()<10){
|
||||
pivot.monteDescendre(0.5);
|
||||
if (pivot.distance()<50.5){
|
||||
pivot.monteDescendre(0.4);
|
||||
}
|
||||
else if(pivot.distance()>11) {
|
||||
pivot.monteDescendre(-0.5);
|
||||
else if(pivot.distance()>52.5) {
|
||||
pivot.monteDescendre(-0.4);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0);
|
||||
@ -51,7 +53,11 @@ public class PivoteBrasHaut extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
@ -22,27 +22,29 @@ public class PivoteBrasMilieux extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(brasTelescopique.distance()<10){
|
||||
brasTelescopique.AvanceRecule(0.5);
|
||||
if(brasTelescopique.distance()>-16.5){
|
||||
brasTelescopique.AvanceRecule(-0.2);
|
||||
brasTelescopique.fermer();
|
||||
}
|
||||
else if(brasTelescopique.distance()>11) {
|
||||
brasTelescopique.AvanceRecule(-0.5);
|
||||
else if(brasTelescopique.distance()<-17.5) {
|
||||
brasTelescopique.AvanceRecule(0.2);
|
||||
}
|
||||
else {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
if (pivot.distance()<10){
|
||||
pivot.monteDescendre(0.5);
|
||||
if (pivot.distance()<43.5){
|
||||
pivot.monteDescendre(0.4);
|
||||
}
|
||||
else if(pivot.distance()>11) {
|
||||
pivot.monteDescendre(-0.5);
|
||||
else if(pivot.distance()>44.5) {
|
||||
pivot.monteDescendre(-0.4);
|
||||
}
|
||||
else{
|
||||
pivot.monteDescendre(0);
|
||||
@ -52,7 +54,11 @@ public class PivoteBrasMilieux extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
brasTelescopique.AvanceRecule(0);
|
||||
pivot.monteDescendre(0);
|
||||
brasTelescopique.ouvrir();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user