We are struggling with finding a way to resolve an error that our code is having, here is the robot.java and the error message.
Robot.java:
// 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;
import com.ctre.phoenix.motorcontrol.InvertType;
import com.ctre.phoenix.motorcontrol.TalonFXInvertType;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
/import edu.wpi.first.wpilibj.cameraserver;
/*
- The VM is configured to automatically run this class, and to call the functions corresponding to
- each mode, as described in the TimedRobot documentation. If you change the name of this class or
- the package after creating this project, you must also update the build.gradle file in the
- project.
*/
public class Robot extends TimedRobot {
public WPI_TalonFX leftPrime = new WPI_TalonFX(0);
public WPI_TalonFX leftFollow = new WPI_TalonFX(1);
public WPI_TalonFX rghtPrime = new WPI_TalonFX(2);
public WPI_TalonFX rghtFollow = new WPI_TalonFX(3);
private DifferentialDrive driveTrain = new DifferentialDrive(leftPrime, rghtPrime);
private Joystick joyRight = new Joystick(0);
/**
- This function is run when the robot is first started up and should be used for any
- initialization code.
*/
@Override
public void robotInit() {
rghtPrime.configFactoryDefault();
rghtFollow.configFactoryDefault();
leftPrime.configFactoryDefault();
leftFollow.configFactoryDefault();
rghtFollow.follow(rghtPrime);
leftFollow.follow(leftPrime);
rghtPrime.setInverted(TalonFXInvertType.CounterClockwise); // change Possibly
leftPrime.setInverted(TalonFXInvertType.Clockwise); // possibly change
leftFollow.setInverted(InvertType.FollowMaster);
rghtFollow.setInverted(InvertType.FollowMaster);
/*driveTrain.setRightSideInverted(false); */
}
@Override
public void robotPeriodic() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopInit() {
}
@Override
public void teleopPeriodic() {
String work = "";
/*get gamepad stick values */
double forw = -joyRight.getRawAxis(1); /* positive is forward */
double turn = -joyRight.getRawAxis(2); /* positive is right */
boolean btn1 = joyRight.getRawButton(1); /* If button is down, print jowstick values */
driveTrain.arcadeDrive(forw, turn);
if (btn1){
System.out.println(work);
}
}
@Override
public void disabledInit() {
}
@Override
public void disabledPeriodic() {
}
@Override
public void testInit() {
}
@Override
public void testPeriodic() {
}
}
Error message:
Driver Station reported IP: 10.49.25.2
Task :downloadDepsPreemptively FAILED
Task :discoverroborio
Discovering Target roborio
Using [email protected]:22 for target roborio
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task â:downloadDepsPreemptivelyâ.
Could not resolve all files for configuration â:roborioReleaseâ.
Could not resolve com.ctre.phoenix:cci:5.21.4.
Required by:
project :
No cached version of com.ctre.phoenix:cci:5.21.4 available for offline mode.
No cached version of com.ctre.phoenix:cci:5.21.4 available for offline mode.
No cached version of com.ctre.phoenix:cci:5.21.4 available for offline mode.
- Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 5s
3 actionable tasks: 2 executed, 1 up-to-date
The terminal process âcmd.exe /d /c gradlew deploy -PteamNumber=4925 --offline -Dorg.gradle.java.home=âC:\Users\Public\wpilib\2022\jdkââ terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.