A couple of students on my team have expressed an interest in writing their own Shuffleboard plugins/widgets.
Normally, I’d point them towards this part of the docs and let them go wild – but in going through them myself to see if there are any bits that I’d need to spend a little time clarifying, I’ve run into an issue.
I’ve been following the docs carefully, which seem to have been updated using this post as a base.
I’ve gotten the repository on my local machine just fine, but VSCode seems convinced that the edu.first
imports don’t exist.
Here’s the snippet in question,
package com.example.simplewidget;
import edu.wpi.first.shuffleboard.api.data.DataType;
import edu.wpi.first.shuffleboard.api.plugin.Description;
import edu.wpi.first.shuffleboard.api.plugin.Plugin;
import edu.wpi.first.shuffleboard.api.widget.ComponentType;
import edu.wpi.first.shuffleboard.api.widget.WidgetType;
import com.example.simplewidget.data.type.PointType;
import com.example.simplewidget.widget.SimplePointWidget;
import java.util.List;
import java.util.Map;
/**
* An example plugin that provides a custom data type (a 2D point) and a simple widget for viewing such data.
*/
@Description(
group = "com.example",
name = "SimpleWidgetExample",
version = "2019.1.1",
summary = "An example plugin that provides a simple data type and a widget for viewing it"
)
public final class SimpleWidgetExamplePlugin extends Plugin {
@Override
public List<DataType> getDataTypes() {
return List.of(
PointType.Instance
);
}
@Override
public List<ComponentType> getComponents() {
return List.of(
WidgetType.forAnnotatedWidget(SimplePointWidget.class)
);
}
@Override
public Map<DataType, ComponentType> getDefaultComponents() {
return Map.of(
PointType.Instance, WidgetType.forAnnotatedWidget(SimplePointWidget.class)
);
}
}
Hovering over the first errors in the file, VSCode insists that “The import edu.wpi cannot be resolved”. That suggests it’s just an issue of making sure the project knows where to look for the file – so I tried to do some digging in the API docs only to find that the packages the repo uses… don’t seem to be a part of wpilib at present??
I figure either,
- I’m missing something silly and/or am blind
- Shuffleboard hasn’t been updated since all the cool kids are using Elastic now, or so I’ve been told.
… so now I’m here. Anyone have any ideas? Thanks in advance for any info!