Can't Select Autonomous

I cannot select my autonomous code in the driverstation/smart control panel. The drop down menu appear, but it does not open to show me all of my different autonomous codes.

I have it programmed in Java, and I followed the WPILIB Iteritive robot example for the autonomous.

can you post the code ?

Here is the code that deals with autonomous:

public class Robot extends IterativeRobot
{

/*
    Initialization code that allows code to be selected in the driver station.
 */
private static final String CENTER_LEFT = "Robot Center Switch Left";
private static final String LEFT_LEFT = "Robot Left Switch Left";
private static final String RIGHT_LEFT = "Robot Right Switch Left";
private static final String CENTER_RIGHT = "Robot Center Switch Right";
private static final String LEFT_RIGHT = "Robot Left Switch Right";
private static final String RIGHT_RIGHT = "Robot Right Switch Right";
private String autoSelected;
private SendableChooser<String> chooser = new SendableChooser<>();
/*
    Declares variables for motors and defines each side of the drivetrain.
 */
private Joystick controller = new Joystick(0); // Declares controller.
private Spark leftFront = new Spark(0); // Declares left front drive motor.
private Spark leftRear = new Spark(1); // Declares left rear drive motor.
private Spark rightFront = new Spark(2); // Declares right front drive motor.
private Spark rightRear = new Spark(3); // Declares right rear drive motor.
private SpeedControllerGroup driveLeft = new SpeedControllerGroup(leftFront, leftRear); // Declares left side of robot
private SpeedControllerGroup driveRight = new SpeedControllerGroup(rightFront, rightRear); // Declares right side of robot
private DifferentialDrive driveTrain = new DifferentialDrive(driveRight, driveLeft);
private Timer timer = new Timer();

/*
    Declares variables for the other functions.
 */
private Talon lift = new Talon(4); // Declares motor that lifts cube mechanism.
private Talon grab = new Talon(5); // Declares motor that grabs the cube.
private Talon climbA = new Talon(6); // Declares motor that climbs.
private Talon climbB = new Talon(7); // Declares motor that climbs.
private SpeedControllerGroup climbGroup = new SpeedControllerGroup(climbA, climbB);


/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
@Override
public void robotInit()
{
    chooser.addObject("Robot Center Switch Left", CENTER_LEFT);
    chooser.addDefault("Robot Left Switch Left", LEFT_LEFT);
    chooser.addObject("Robot Right Switch Left", RIGHT_LEFT);
    chooser.addObject("Robot Center Switch Right", CENTER_RIGHT);
    chooser.addObject("Robot Left Switch Right", LEFT_RIGHT);
    chooser.addObject("Robot Right Switch Right", RIGHT_RIGHT);
    SmartDashboard.putData("Auto choices", chooser);
}

/**
 * This autonomous (along with the chooser code above) shows how to select
 * between different autonomous modes using the dashboard. The sendable
 * chooser code works with the Java SmartDashboard. If you prefer the
 * LabVIEW Dashboard, remove all of the chooser code and uncomment the
 * getString line to get the auto name from the text box below the Gyro
 *
 * <p>You can add additional auto modes by adding additional comparisons to
 * the switch structure below with additional strings. If using the
 * SendableChooser make sure to add them to the chooser code above as well.
 */
@Override
public void autonomousInit()
{
    autoSelected = chooser.getSelected();
    // autoSelected = SmartDashboard.getString("Auto Selector",
    // defaultAuto);
    System.out.println("Auto selected: " + autoSelected);
}

/**
 * This function is called periodically during autonomous.
 */
@Override
public void autonomousPeriodic()
{
    switch (autoSelected)
    {
        case LEFT_LEFT: // Drives 168" forward and 55.56" right
            driveTrain.arcadeDrive(1,0);
            timer.delay(5);
            driveTrain.arcadeDrive(0.5, 1);
            timer.delay(2);
            break;
        case CENTER_LEFT:
            driveTrain.arcadeDrive(1, -.5);
            break;
        case RIGHT_LEFT:
            // Put auto code here
            break;
        case LEFT_RIGHT:
            // Put auto code here
            break;
        case CENTER_RIGHT:
            // Put auto code here
            break;
        case RIGHT_RIGHT:
            // Put auto code here
            break;
    }
}

/**
 * This function is called periodically during operator control.
 */
@Override

}

I didn’t noticed really see any error in your code, you should be able to select your option in the dashboard. which one are you using the SmartDashboard or the ShuffleBoard ?

I am using the SmartDashboard, that comes with the NI Download.

If anyone else could help, it would be much appreciated!

Is your issue that the chooser does not show up on the SmartDashboard?

I’m confused as to what you meant by the “drop down” shows up.

The chooser shows up and says to “select autonomous”, but it doesn’t respond to me clicking it nor the little downward arrow.

1 Like

A problem that affected our team, and others, is that selection labels more than 16 characters in length are not handled properly. I note yours look a lot like our initial, too long, labels.

First simple question:
Are you in Editable mode by accident?

It’s not always visually clear that the window is in editable mode, but it exhibits similar symptoms as to what you are saying.

Short of that, I would make sure to reduce the string length in your chooser items, there are some gremlins there as your strings get longer.

How do I get out of editable mode if I am in it?

There should be a View menu at the top. Click on that and the first MenuItem should be called “Editable”. If it has a check mark by it, then it’s in editable mode. Click it and it should switch. Here’s a link to documentation on it.
https://wpilib.screenstepslive.com/s/currentCS/m/smartdashboard/l/255415-changing-the-display-properties-of-a-value