Thundrio
01-02-2012, 21:15
As I am going through the state of my teams code, I have a few questions I wanted to ask.
Also I am using iterativeRobot()
1) When I send a line to the driverstation using driverStationLCD(probably not the right syntax, but you know what I want), It displays the text, but does not update the values ever if they are changed in teleop(). I tried putting myLCD.updateLCD() at the bottom of my teleopPeriodic() function, but when I do netbeans says the myLCD variable is not created, even though I create it earlier where the output lines to the ds are. also to be clear, I have verified that the values are actually changing by using the Netconsole+System.out.println().
2) We are able to use the Microsoft Kinect to control the robot, and while we don't know if it will be used during competition, it will be a great way to demonstrate the robot. What I have done is split the teleoperated section of the code into two sections using an if statement like this:
if (isKinect == 1) {
// kinect enabled version of the code goes here
}
else
{
//normal code goes here
}
Right now all of my code is in 1 class file, although I would like to split it up into multiple files, to make it easier to read. it would then theoretically look like this:
if (isKinect == 1) {
run kinectcode.java;
}
else{
run normalcode.java;
}
However I have never worked with multiple files together, and so I am not sure how to do this.
3)right now I have shAUTOFIRE (one of my buttons) written using the .get() function (I believe it's a function), but I only want it run once, not for as long as it's held down.
I know that I could do this using a keyboard:
public void keyPressed(KeyEvent e) {
keyCode = e.getKeyCode();
swith (keyCode) {
case KeyEvent.VK_SPACEBAR:
//do autofire stuff
break;
}
however, I am at a loss as to what to do with the buttons. I looked at the API documentation and found the whenPressed() method, which seems like It should be similar as to what I do with the keyboard, but I don't know what to do.
Thank you for any and all help.
Also I am using iterativeRobot()
1) When I send a line to the driverstation using driverStationLCD(probably not the right syntax, but you know what I want), It displays the text, but does not update the values ever if they are changed in teleop(). I tried putting myLCD.updateLCD() at the bottom of my teleopPeriodic() function, but when I do netbeans says the myLCD variable is not created, even though I create it earlier where the output lines to the ds are. also to be clear, I have verified that the values are actually changing by using the Netconsole+System.out.println().
2) We are able to use the Microsoft Kinect to control the robot, and while we don't know if it will be used during competition, it will be a great way to demonstrate the robot. What I have done is split the teleoperated section of the code into two sections using an if statement like this:
if (isKinect == 1) {
// kinect enabled version of the code goes here
}
else
{
//normal code goes here
}
Right now all of my code is in 1 class file, although I would like to split it up into multiple files, to make it easier to read. it would then theoretically look like this:
if (isKinect == 1) {
run kinectcode.java;
}
else{
run normalcode.java;
}
However I have never worked with multiple files together, and so I am not sure how to do this.
3)right now I have shAUTOFIRE (one of my buttons) written using the .get() function (I believe it's a function), but I only want it run once, not for as long as it's held down.
I know that I could do this using a keyboard:
public void keyPressed(KeyEvent e) {
keyCode = e.getKeyCode();
swith (keyCode) {
case KeyEvent.VK_SPACEBAR:
//do autofire stuff
break;
}
however, I am at a loss as to what to do with the buttons. I looked at the API documentation and found the whenPressed() method, which seems like It should be similar as to what I do with the keyboard, but I don't know what to do.
Thank you for any and all help.