Ok, so while porting our last year’s labview code to java, I found that the labview version would do things like send pwm values to the driverstation.
How would I go about in doing this in java? I couldn’t find anything that stuck out in the DriverStation API
Look at the DashboardExample Project for interfacing to the LabVIEW dashboard. You could also look into the ZomB or SmartDashboard dashboards.
Where do you find this ZomB dashboard? — OK, I found the reference to this.
Where is the documentation on the SmartDashboard?
I would just like to say that, we are experimenting with the dashboard that is already on the classmate.
We have to run the following code each loop of operator control.
float gyroValue;
Dashboard lowDashData = DriverStation.getInstance().getDashboardPackerLow();
lowDashData.addCluster();
{
lowDashData.addCluster();
{ //analog modules
lowDashData.addCluster();
{
for (int i = 1; i <= 6; i++) {
lowDashData.addFloat((float) AnalogModule.getInstance(1).getAverageValue(i));
}
gyroValue = AnalogModule.getInstance(1).getAverageValue(7);
if (gyroValue > 360)
gyroValue %= 360;
lowDashData.addFloat((float) gyroValue);
lowDashData.addFloat((float) AnalogModule.getInstance(1).getAverageValue(8));
}
lowDashData.finalizeCluster();
lowDashData.addCluster();
{
for (int i = 1; i <= 6; i++) {
lowDashData.addFloat((float) AnalogModule.getInstance(2).getAverageValue(i));
}
gyroValue = AnalogModule.getInstance(1).getAverageValue(7);
if (gyroValue > 360)
gyroValue %= 360;
lowDashData.addFloat((float) gyroValue);
lowDashData.addFloat((float) AnalogModule.getInstance(1).getAverageValue(8));
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
lowDashData.addCluster();
{ //digital modules
lowDashData.addCluster();
{
lowDashData.addCluster();
{
int module = 4;
lowDashData.addByte(DigitalModule.getInstance(module).getRelayForward());
lowDashData.addByte(DigitalModule.getInstance(module).getRelayForward());
lowDashData.addShort(DigitalModule.getInstance(module).getAllDIO());
lowDashData.addShort(DigitalModule.getInstance(module).getDIODirection());
lowDashData.addCluster();
{
for (int i = 1; i <= 10; i++) {
lowDashData.addByte((byte) DigitalModule.getInstance(module).getPWM(i));
}
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
lowDashData.addCluster();
{
lowDashData.addCluster();
{
int module = 6;
lowDashData.addByte(DigitalModule.getInstance(module).getRelayForward());
lowDashData.addByte(DigitalModule.getInstance(module).getRelayReverse());
lowDashData.addShort(DigitalModule.getInstance(module).getAllDIO());
lowDashData.addShort(DigitalModule.getInstance(module).getDIODirection());
lowDashData.addCluster();
{
for (int i = 1; i <= 10; i++) {
lowDashData.addByte((byte) DigitalModule.getInstance(module).getPWM(i));
}
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
}
lowDashData.finalizeCluster();
lowDashData.addByte(Solenoid.getAll());
}
lowDashData.finalizeCluster();
lowDashData.commit();
Best,
I posted a java class here that will handle basic communications with the driver station and dashboard. While I’m sure it could be more sophisticated, it does work (at least so far ). I’ll try to update things as I sort more of the code out.
I posted a class here that I’m using to handle communications with the driver station and dashboard. I’m sure it if feature incomplete, but at the moment it does a good job of interfacing with both station and dash, and simplifies communications with the station LCD. If you find it useful, enjoy, just toss a blurb in there giving me and Team 647 some credit, and if you improve it let me know
The SmartDashboard and ZomB dashboard are both projects on firstforge.wpi.edu. You don’t need an account to access either of them, and the source code is included with both distributions.