Sendable chooser not apearing on smartdashboard

We are trying to get the chooser on the smart dashboard using the putdata() but it will not appear on the dashboard here is our code does anyone know what we’re doing wrong

/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package frc.robot;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.XboxController;
import frc.robot.commands.*;
import frc.robot.subsystems.*;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import edu.wpi.first.wpilibj.smartdashboard.*;
/**
 * 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 {
  // The robot's subsystems and commands are defined here...
  public static ShooterSubsystem shooter = new ShooterSubsystem();
  public static ConvayerIntakeSubsystem convayerIntake = new ConvayerIntakeSubsystem();
  public static RotaterSubsystem rotater = new RotaterSubsystem();
  public static ClimberSubsystem climber = new ClimberSubsystem();
  // public static DriveSubsystem drive = new DriveSubsystem();

  private final TestAuto1 test1 = new TestAuto1();
  private final TestAuto2 test2 = new TestAuto2();

  SendableChooser<Command> chooser = new SendableChooser<>();

  public static int shooterRPM = 4000;
  // joysticks
  Joystick _joy = new Joystick(0);
  Joystick _joy2 = new Joystick(0);
  // joystick buttons

  /**
   * The container for the robot. Contains subsystems, OI devices, and commands.
   */
  public RobotContainer() {

      chooser.addOption("test1", test1);
      chooser.addOption("test2", test2);
      SmartDashboard.putData("autos",chooser);
    // Configure the button bindings
    configureButtonBindings();
  }

  /**
   * 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() {
    // button presses

    // toggle to rev up shooter
    new JoystickButton(_joy, 2).toggleWhenPressed(new SpinShooter(shooterRPM));

    // hold to drive convayer and shooter to shoot balls when done will drop the
    // adjuster back to 0
    new JoystickButton(_joy, 8).whileHeld(new ShootBalls());

    // will adjust the shooter
    new JoystickButton(_joy, 6).toggleWhenPressed(new AdjustShooter(300));

    //puts the shooter adjuster to controll panell position
    new JoystickButton(_joy, 5).toggleWhenPressed(new AdjustShooter(500));    

    //spins rotater to rotation control position
    new JoystickButton(_joy, 4).whileHeld(new SpinRotaterToPosition(500));

    //unwinds winch 
    new JoystickButton(_joy2, 2).whileHeld(new DriveClimberWinch(1));

    //winds up winch
    new JoystickButton(_joy2, 4).whileHeld(new DriveClimberWinch(-1));

    //drive climber left
    new JoystickButton(_joy2, 1).whileHeld(new DriveClimberDrive(1));

    //drive climber right
    new JoystickButton(_joy2, 3).whileHeld(new DriveClimberDrive(-1));

    //bring winch to bottom
    new JoystickButton(_joy2, 8).whileHeld(new DriveClimberWinchToPosition(100));



  }

  /**
   * Use this to pass the autonomous command to the main {@link Robot} class.
   *
   * @return the command to run in autonomous
   */
  public Command getAutonomousCommand() {
    // An ExampleCommand will run in autonomous
    return null;
  }
}

RobotContainer has to be instantiated from the Robot class. Are you instantiating it in your Robot class?

 public void robotInit() {
    // Instantiate our RobotContainer.  This will perform all our button bindings, and put our
    // autonomous chooser on the dashboard.
    m_robotContainer = new RobotContainer();
  }

yes I am

Sometimes things get deleted from SmartDashboard. Maybe you can try creating a new “layout”, or whatever it’s called on SmartDashboard. This will make it so the position of widgets is reset on the dashboard.

i tried just tried that i also tried using shuffleboard and the drop-down to choose auto was empty

Well, it’s good that you at least see the “autos” chooser on Shuffleboard. I don’t think this will affect anything, but can you call setDefaultOption on your chooser so the chooser has a default option?

It might be that the widgets on SmartDashboard and Shuffleboard require a default option before working correctly. I could be wrong, though.

I added a default command but still doesn’t show on either dashboard

Does ShuffleBoard display “Network Tables connected” in the bottom-right?

Can you post a screenshot of Outlineviewer showing the autos chooser?

I added a default command to your project and it showed up on smartdashboard for me

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.