|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#7
|
||||
|
||||
|
Re: Robot Nightmare!
The main issue I see with your IterativeRobot code is that you're using it as though it were a SimpleRobot. The startCompetition() method of iterative robot works like this:
Code:
while(robot is alive) {
check for new driver station packet;
if(new driver station packet has been received)
periodic();
continuous();
}
However, doing something like this requires having your program work repeatedly on state data, which in turn requires a fairly different thought process from "typical" programming. Instead of asking "What series of steps gets me from point A to point B?", you must ask "If I start at A, how can I determine the next step toward B from the data generated from the previous step(s)?". Long story short, IterativeRobot doesn't like your input because you never give it a chance to receive it. Also, on the topic of the DriverStationLCD: when you start up the driver station, there's a light-gray section on the right. This is actually a text display area, and you can use DriverStationLCD to write to it, by doing Code:
DriverStationLCD.getInstance().println(<line>,<column>,<text>); DriverStationLCD.getInstance().updateLCD() <column> is an int from 1 to 21, defining the start of where you want the text to be displayed. <text> is the string you want to display. On the LCD, 2 things happen that you might not be expecting. First, your text is truncated to fit into the 21 character limit. So, for example, if you tell it to write "Hello, World!" starting from the 10th column, it will become "Hello, Worl", because the last 2 characters don't fit within the limits. Secondly, things overwrite each other. So if you first print out "Hello", then print out "hi" to the same line, you will end up with "hillo". Best of luck in the upcoming crunch-time! |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|