Open
Description
Describe the bug
withPosition is being honored inside a ShuffleboardLayout of type kList.
To Reproduce
Steps to reproduce the behavior:
- create a new project and put the following into
src/main/java/frc/robot/Robot.java
package frc.robot;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
public class Robot extends TimedRobot {
private ShuffleboardTab shuffTab = Shuffleboard.getTab("MyTab");
public void addTab(String name) {
ShuffleboardLayout myGroup = shuffTab.
getLayout(name, BuiltInLayouts.kList).withSize(1, 3);
myGroup.add("Enable", true).withWidget(BuiltInWidgets.kToggleSwitch).
withPosition(0, 0).getEntry();
myGroup.add("Invert", false).withWidget(BuiltInWidgets.kToggleSwitch).
withPosition(0, 1).getEntry();
myGroup.add("Rotations", 0).withPosition(0, 2).getEntry();
myGroup.add("Target", 1).withPosition(0, 3).getEntry();
}
@Override
public void robotInit() {
addTab("group 1");
addTab("group 2");
addTab("group 3");
}
@Override
public void autonomousPeriodic() { }
@Override
public void teleopPeriodic() { }
}
- Run project
- Open shuffleboard
Expected behavior
I expected each "group" to have the indicated order of widgets.
What happens is that the groups differ seemingly randomly.
I expected that widgets order inside would be 'Enable', 'Invert', 'Rotations', 'Target' based on the use of withPosition.
Note that this does work with kGrid.
Desktop (please complete the following information):
- WPILib Version:2022.3.1
- OS: Linux
- Java version: from wpilib: openjdk version "11.0.13" 2021-10-19
- C++ version: N/A