Trying to create a tankdrive in the Container. Having troubles getting left stick to control left side and right stick controlling right. Here’s the code for the container:
// Copyright © 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 edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.GenericHID.Hand;
import frc.robot.subsystems.*;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.RunCommand;
import static frc.robot.Constants.*;
/**
-
This class is where the bulk of the robot should be declared. Since Command-based is a
-
“declarative” paradigm, very little robot logic should actually be handled in the {@link Robot}
-
periodic methods (other than the scheduler calls). Instead, the structure of the robot (including
-
subsystems, commands, and button mappings) should be declared here.
*/
public class RobotContainer {
XboxController xbox = new XboxController(kXboxPort);
//XboxController leftStickYController = leftJoystick(kLeft);
//XboxController rightStickYController = rightJoystick(kRight);
Joystick leftJoystick = new Joystick(kLeft);
Joystick rightJoystick = new Joystick(kRight);
// The robot’s subsystems and commands are defined here…
private final Drive drive = new Drive();
/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
// Configure the button bindings
configureButtonBindings();
drive.setDefaultCommand(
new RunCommand(
() -> drive.tankDrive(xbox.getY(kLeft)),
() -> drive.tankDrive(xbox.getY(kRight)),
)
)
;
}
/**
-
Use this method to define your button->command mappings. Buttons can be
-
created by instantiating a {@link GenericHID} or one of its subclasses
-
({@link edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then
-
passing it to a {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
*/
private void configureButtonBindings() {}
/**
-
Use this to pass the autonomous command to the main {@link Robot} class.
-
@return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return null;
}
}