Go to Post Teams that take care of the little things often have much less trouble with the big things! - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2011, 18:52
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
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
__________________
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2011, 16:01
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2011, 13:13
DCRich DCRich is offline
Mentor
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2006
Location: Steinert H.S., Hamilton NJ
Posts: 21
DCRich is an unknown quantity at this point
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?

Last edited by DCRich : 25-01-2011 at 13:40. Reason: Answered my question elsewhere
Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2011, 14:04
techplex's Avatar
techplex techplex is offline
Blake B
AKA: Blake
FRC #4909 (The Bionics)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2007
Location: Massachusetts
Posts: 95
techplex is just really nicetechplex is just really nicetechplex is just really nicetechplex is just really nice
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,
__________________
Blake
Electrical, Programming and Design

Creator FRC Q&A 2017
Mass FRC Team 4909: The Bionics
Maine FRC Team 5122: The RobOTies (2014-2015)
Maine FRC Team 2648: Infinite Loop (2008-2011)
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2011, 15:14
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Re: Sending basic data to driver station

Quote:
Originally Posted by kinganu123 View Post
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 25-01-2011, 22:04
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
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
Reply With Quote
  #7   Spotlight this post!  
Unread 27-01-2011, 14:35
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Sending basic data to driver station

Quote:
Originally Posted by DCRich View Post
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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:36.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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