Hello, I need some help trying to find a basic template for a tank drive robot. I also have part of a code that I can link in the replies so that it may be easier for you to see my progress as of now.
My main struggle with what I have so far is where exactly to place it within Robot.java itself and how to bind the commands to a controller (Xbox). Any suggestions are welcome.
TalonFX left1;
TalonFX left2;
TalonFX left3;
TalonFX right1;
TalonFX right2;
TalonFX right3;
public TankDrive() {
left1 = new TalonFX(deviceNumber);
left2 = new TalonFX(deviceNumber);
left3 = new TalonFX(deviceNumber);
right1 = new TalonFX(devicenumber);
right2 = new TalonFX(deviceNumber);
right3 = new TalonFX(deviceNumber);
}
public void drive(double leftValve, double rightValve);
left1.set(ControlMode.PercentOutput, demand);
left2.set(ControlMode.PercentOutput, demand);
left3.set(ControlMode.PercentOutput, demand);
Check out this example: allwpilib/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/arcadedrivexboxcontroller at main · wpilibsuite/allwpilib · GitHub
There’s also more general documentation here: FIRST Robotics Competition Control System — FIRST Robotics Competition documentation
This example is also available as a new project template through vscode
GitHub - NE-Robotics/Java-Framework: An opensource FRC java framework to make blending simulated & real robot code a breeze since as every programmer knows you will always get the bot last, always :) Provides a good framework for layout and code structure along with support for path planner and April tags along with easy simulation.