Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Sending basic data to driver station (http://www.chiefdelphi.com/forums/showthread.php?t=89905)

kinganu123 23-01-2011 18:52

Sending basic data to driver station
 
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

Re: Sending basic data to driver station
 
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

Re: Sending basic data to driver station
 
Where do you find this ZomB dashboard? --- OK, I found the reference to this.

Where is the documentation on the SmartDashboard?

techplex 25-01-2011 14:04

Re: Sending basic data to driver station
 
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.

Code:

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,

wdell 25-01-2011 15:14

Re: Sending basic data to driver station
 
Quote:

Originally Posted by kinganu123 (Post 1006694)
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 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

Re: Sending basic data to driver station
 
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 :)

BradAMiller 27-01-2011 14:35

Re: Sending basic data to driver station
 
Quote:

Originally Posted by DCRich (Post 1008018)
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.


All times are GMT -5. The time now is 22:17.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi