View Single Post
  #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: 94
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