Log in

View Full Version : Sending basic data to driver station


kinganu123
23-01-2011, 18:52
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

Joe Ross
24-01-2011, 16:01
Look at the DashboardExample Project for interfacing to the LabVIEW dashboard. You could also look into the ZomB or SmartDashboard dashboards.

DCRich
25-01-2011, 13:13
Where do you find this ZomB dashboard? --- OK, I found the reference to this.

Where is the documentation on the SmartDashboard?

Techwiz
25-01-2011, 14:04
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(modu le).getRelayForward());
lowDashData.addByte(DigitalModule.getInstance(modu le).getRelayForward());
lowDashData.addShort(DigitalModule.getInstance(mod ule).getAllDIO());
lowDashData.addShort(DigitalModule.getInstance(mod ule).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(modu le).getRelayForward());
lowDashData.addByte(DigitalModule.getInstance(modu le).getRelayReverse());
lowDashData.addShort(DigitalModule.getInstance(mod ule).getAllDIO());
lowDashData.addShort(DigitalModule.getInstance(mod ule).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,

wdell
25-01-2011, 15:14
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

I posted a java class here (http://www.chiefdelphi.com/forums/showthread.php?t=90065) 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.

wdell
25-01-2011, 22:04
I posted a class here (http://www.chiefdelphi.com/forums/showthread.php?t=90065) 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 :)

BradAMiller
27-01-2011, 14:35
Where do you find this ZomB dashboard? --- OK, I found the reference to this.

Where is the documentation on the SmartDashboard?

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.