Log in

View Full Version : sending info to a console


a kenny03
20-01-2010, 16:47
so our team is using java this year, and we have been experiencing difficulty with sending output data to the classmate console. anyone have any way to help me out?

James Dempsey
20-01-2010, 19:46
If you are trying to send an output to the console on a development computer, you must use the System.out.print or println methods to send data to the console wheter it be strings, integers, characters etc.

If you want to send information to the dashboard, look through the sample code provided with the FRC plugin in NetBeans.

Hope this helps
-
James D

Edit:
After re-reading your post it sounds like you are trying to send data to the User Messages section of the Dashboard. To access the lower part of the Dashboard you must use the class Dashboard. Here is an example of how to have a class object for the lower half of the Dashboard:

Dashboard lowDashData = DriverStation.getInstance().getDashboardPackerLow( );

You then have to add clusters in order to be able to send your data.
Again sorry if you already knew this but I hope this helped you

a kenny03
21-01-2010, 09:05
yeah. i want something like the console from last year. we use windriver, and our team was able to get output data from the robot. thats what we are trying to replicate or get as close as possible

jhersh
21-01-2010, 16:44
After re-reading your post it sounds like you are trying to send data to the User Messages section of the Dashboard. To access the lower part of the Dashboard you must use the class Dashboard.

I believe that's inaccurate. If you want to send strings to the User Messages, on the Driver Station, you need to use the DriverStationLCD class. If you want to send data to a Dashboard (where you would have to add a text box or other controls), then you use the Dashboard class.

James Dempsey
21-01-2010, 21:46
Yes my mistake. I was extremely tired when I responded to this post. The DashboardLCD class should be the class you would use. Here is the link for methods and such:
http://www.wbrobotics.com/javadoc/edu/wpi/first/wpilibj/DriverStationLCD.html

Again sorry for the confusion there on my misinformation, my bad.

a kenny03
21-01-2010, 22:36
i have the import for the driverstationlcd class, but i have no clue what to do with it... i think one of my fellow team members might have been able to solve this problem, but i don't know if it works. (that's tomorrow's job)
another note...
does anyone know what 'private access' means, and how to get past it?

jhersh
21-01-2010, 22:42
i have the import for the driverstationlcd class, but i have no clue what to do with it... i think one of my fellow team members might have been able to solve this problem, but i don't know if it works. (that's tomorrow's job)
another note...
does anyone know what 'private access' means, and how to get past it?

All you need to do is call println() for each line you want to send and then call updateLCD() once after println'ing all the lines that you want to send. You don't need any private members.

a kenny03
22-01-2010, 10:16
All you need to do is call println() for each line you want to send and then call updateLCD() once after println'ing all the lines that you want to send. You don't need any private members.

well, i figured that *face palm* but i am still getting an error. i am using the dsLCD class, but i am still getting a private access error

this is my code...
DriverStationLCD robot = new DriverStationLCD();
robot.println(DriverStationLCD.Line.kUser2,1,"this prints on the first line");
robot.updateLCD();

derekwhite
22-01-2010, 11:30
Hi A Kenney03,

Call "DriverStationLCD getInstance()" instead of "new DriverStationLCD()".

Since there can only be one DriverStationLCD, the private access prevents you from trying to create two objects to refer to the same item on the driver station.

BTW, errors like this are easier to comment on if you can post the error message. I wasn't sure if you were talking about a compile error, network error, code error, or what :-)

a kenny03
22-01-2010, 16:34
ok. thank you. that helps. but new we are having trouble with the user messages system. is there a maximum limit on strings and lines? and how do we use the first line?

jhersh
22-01-2010, 23:19
ok. thank you. that helps. but new we are having trouble with the user messages system. is there a maximum limit on strings and lines? and how do we use the first line?

There are 6 lines... 21 characters per line. This is based on compatibility with last year's DS.

To use the first line, use the enum value to specify the first line.

full_auto
31-01-2010, 22:42
Hey guys, first post here.
We are also having trouble with using DriverStationLCD. The code that I am attempting to use is as follows:

textOut.println(DriverStationLCD.Line.kUser3, 2, message);
textOut.updateLCD();

where 'textOut' is an instance of DriverStationLCD retrieved with DriverStationLCD.getInstance() and 'message' is a String that is never more than 15 characters.

This code is executed periodically. The problem is that after it executes a few times the DS stops responding and must be restarted to regain functionality. This does not happen if I remove those two lines, so I'm fairly sure that they are the cause.

Has anyone gotten this to work? Any help is greatly appreciated.

full_auto
01-02-2010, 17:53
Nobody knows anything that could help?

jhersh
01-02-2010, 18:31
This code is executed periodically. The problem is that after it executes a few times the DS stops responding and must be restarted to regain functionality. This does not happen if I remove those two lines, so I'm fairly sure that they are the cause.

Where are they called from? How quickly are they called? Does rebooting the robot affect anything, or is restarting the driver station application the only thing that makes it work again?

full_auto
01-02-2010, 19:18
Where are they called from? How quickly are they called? Does rebooting the robot affect anything, or is restarting the driver station application the only thing that makes it work again?

I just got in here a little while ago... It turns out that the problem was not related to the calls to DriverStationLCD, removing those lines only made the error occur much later. All is well now. Thanks.

jhersh
01-02-2010, 19:28
I just got in here a little while ago... It turns out that the problem was not related to the calls to DriverStationLCD, removing those lines only made the error occur much later. All is well now. Thanks.

So... for anyone else who runs into this behavior, please explain what it ended up being and how you fixed it.

Thanks
-Joe

full_auto
01-02-2010, 22:23
So... for anyone else who runs into this behavior, please explain what it ended up being and how you fixed it.

Thanks
-Joe

Sorry, no problem. 'message' was sometimes being indexed out of an array prior to those two lines and I had sized the array incorrectly, so I was getting IndexOutOfBounds exceptions :( I did not see the exceptions because I was using a development machine separate from the DS. Fixing that by properly sizing the array was the solution (i'm ashamed that I missed this)

I do not know why commenting the two lines with DriverStationLCD seemed to delay the problem. It may have been a coincidence...

I apologize for the confusion. DriverStationLCD appears to work as intended and was not the cause of my trouble. Thank you for your responses.

Regards,
Bill

KevinJ
03-02-2010, 11:20
This code is executed periodically. The problem is that after it executes a few times the DS stops responding and must be restarted to regain functionality. This does not happen if I remove those two lines, so I'm fairly sure that they are the cause.
Where are they called from? How quickly are they called? Does rebooting the robot affect anything, or is restarting the driver station application the only thing that makes it work again?

It turns out that the problem was not related to the calls to DriverStationLCD, removing those lines only made the error occur much later. All is well now. Thanks.

A note to everyone that doing this to send data back to the DS...

Make sure you aren't running this code CONSTANTLY. Sending new messages and running the updateLCD() method too fast will run the cRIO out of memory, and my guess is because it backlogs all the packets and fills up the memory. You'll get an OutOfMemoryError, and will have to reboot the cRIO to do anything else (like load new code).

(Found this out the hard way on WPILibJ version 1.0.0a, and my guess is it happens with the latest version too...)

jhersh
03-02-2010, 15:08
A note to everyone that doing this to send data back to the DS...

Make sure you aren't running this code CONSTANTLY. Sending new messages and running the updateLCD() method too fast will run the cRIO out of memory, and my guess is because it backlogs all the packets and fills up the memory. You'll get an OutOfMemoryError, and will have to reboot the cRIO to do anything else (like load new code).

(Found this out the hard way on WPILibJ version 1.0.0a, and my guess is it happens with the latest version too...)

That's a bit strange. Are you sure that's the only thing that's happening in your loop? I just looked at the code path for that in Java and I don't see any allocations at all in that loop. Are you allocating memory yourself? Is the out of memory error coming from the Java VM or from vxWorks?