Go to Post Don't put any weight into the OPR. It's ugly and its momma dresses it funny. - wilsonmw04 [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2011, 20:39
Unoquadium Unoquadium is offline
The Parlor Generals
AKA: Ilya Rubnich
FRC #0334 (Tech Knights)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Brooklyn, NY
Posts: 8
Unoquadium is an unknown quantity at this point
Input Monitoring

I'm pretty new to robot programming so my fundamentals may be a bit off here (I'm good at Java itself, not robot Java). Bear with me here guys

So I'm using a Joystick that's pretty easy to configure and I've proven that I am in fact receiving correct info from the axes and the buttons. The only thing I really want to do is print it out in the "User Messages" box in the Driver Station.

Now I've gotten up to actually printing info out using DriverStationLCD but the problem with it is, the info box only updates itself once and only when the robot is first enabled after I've compiled the code. Then that same info stays there no matter how many times I re-enable. The only way to update the info is to recompile the code and enable again (and even then only the initial input gets displayed, it's not updated real-time like I'd want it to be).

A bit more background on the code:
I'm using the IterativeRobot template.
I've tried running it from both the Periodic and Continuous teleop methods, and neither work. From what I've read, the method is supposed to be continuously called so me being logical I put in commands to retrieve the info from the joystick and then output it. As I'm thinking now the method (running continuously and all) should be retrieving fresh info and updating the LCD quite often (definitely not never).

Anyway here's the code for my teleopPeriodic() method:
Notes:
lXAxis/lYAxis are doubles.
buttons are booleans
stick is a Joystick object
st is a DriverStation object
out is a DriverStationLCD object.
Code:
    public void teleopPeriodic() {

        lXAxis = st.getStickAxis(1, 1);
        lYAxis = st.getStickAxis(1, 2);
        button1 = stick.getRawButton(1);
        button2 = stick.getRawButton(2);
        button3 = stick.getRawButton(3);
        button4 = stick.getRawButton(4);

        String b1out = "B1: " + button1;
        String b2out = "B2: " + button2;
        String b3out = "B3: " + button3;
        String b4out = "B4: " + button4;
        String lyaxisout = "LYAxis: " + lYAxis;
        String lxaxisout = "LXAxis: " + lXAxis;

        out.println(DriverStationLCD.Line.kMain6, 1, b1out);
        out.println(DriverStationLCD.Line.kUser2, 1, b2out);
        out.println(DriverStationLCD.Line.kUser3, 1, b3out);
        out.println(DriverStationLCD.Line.kUser4, 1, b4out);
        out.println(DriverStationLCD.Line.kUser5, 1, lyaxisout);
        out.println(DriverStationLCD.Line.kUser6, 1, lxaxisout);
        out.updateLCD();
        
    }
Reply With Quote
 


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 10:51.

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