View Single Post
  #1   Spotlight this post!  
Unread 28-01-2012, 22:58
loafdog loafdog is offline
Registered User
AKA: Maciej
FRC #2876 (DevilBotz)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2009
Location: Burlington, MA
Posts: 33
loafdog is an unknown quantity at this point
System.out.println output jumbled

Hi,
We are trying to print out info to console using System.out.println and see the output look jumbled. We are using command based template and want to have the robot run image funcs and output particle reports when a button on joystick is pressed. I found a post that mentioned outputting too fast will cause problems so we added some delays(maybe not enough?) but still see issues. The thread is this one, posts 10 & 11:
http://www.chiefdelphi.com/forums/showthread.php?t=89740&highlight=crio+console+outp ut

Anyone have suggestions/ideas about what to do to make printing debug info work?

The code that prints stuff while running in a command looks like this:
Code:
   private void printParticleReports(String str, BinaryImage img) {
        try {
            System.out.println("* " + str + "*********************************************");
            ParticleAnalysisReport[] reports =
                    img.getOrderedParticleAnalysisReports();
            for (int i = 0; i < reports.length; i++) {
                ParticleAnalysisReport r = reports[i];
                System.out.println("Particle(" + (i + 1) + "/" + reports.length
                        + ")\n" + r.toString());
                System.out.println("");
                Timer.delay(.2);
            }
            System.out.println(img.getNumberParticles()
                    + "  " + Timer.getFPGATimestamp());
            System.out.println("**********************************************");
            Timer.delay(.2);
        } catch (NIVisionException ex) {
            ex.printStackTrace();
        }
    }
One example of jumbled output looks like this:

Quote:
-> arg 1
[cRIO]
[cRIO] * bigobj******************************************** *
[cRIO] 031250000000000444 , 0.0 )
[cRIO] Area : 301746.0
[cRIO] percent : 98.224609375
[cRIO] Bounding Rect : ( 0 , 0 ) 640*480
[cRIO] Quality : 98.33023755987878
[cRIO]
[cRIO]
[cRIO] Particle(1/2)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 319 , 240 )
[cRIO] normalized : ( -0.0Particle(2/2)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 323 , 31 )
[cRIO] normalized : ( 0.009374999999999911 , -0.8708333333333333 )
[cRIO] Area : 272.0
[cRIO] percent : 0.08854166666666666
[cRIO] Bounding Rect : ( 294 , 29 ) 55*7
[cRIO] Quality : 95.77464788732394
[cRIO]
[cRIO]
[cRIO] 2 146.245212
[cRIO] **********************************************
[cRIO]
[cRIO] 652 )
[cRIO] Area : 307200.0
[cRIO] percent : 100.0
[cRIO] Bounding Rect : ( 0 , 0 ) 640*480
[cRIO] Quality : 100.0
[cRIO]
[cRIO]
[cRIO] Particle(1/1)
[cRIO] Particle Report:
[cRIO] Image Height : 480
[cRIO] Image Width : 640
[cRIO] Center of mass : ( 319 , 239 )
[cRIO] normalized : ( -0.0031250000000000444 , -0.004166666666666vexhull************************** *******************
[cRIO]
[cRIO] * con1 146.837495
[cRIO] **********************************************
[cRIO]
[cRIO]
[cRIO] * filtered****************************************** ***
[cRIO] 0 147.054589
[cRIO] **********************************************
[cRIO]
Thanks.
Reply With Quote