Hi, recently I’ve had access to our robot, and I just had the idea of passing values to the brain and controller for debugging during our autonomous routine. I’ve read previous topics about inserting a 50 ms delay after calling the brain/controller clear command, but sometimes the brain’s lcd screen just stays black and the controller never clears. How would I ensure that the lcd screens on the brain and controller are consistently cleared?
It would be helpful if you could post your code. Edit: I just realized this was in pros support, so I probably can’t help you, but my statement stands.
void initialize() {
// clearing brain lcd
pros::lcd::initialize();
pros::delay(50);
// clearing controller lcd
controller.clear();
pros::delay(50);
}
It is hard for everyone on the forum to help you figure out your problem and how to improve your code without your full code. That being said, you may not have a specific problem with your code, you could just be asking for advice.
Thoughts on the code you posted:
You do have to initialize the lcd, but you shouldn’t keep initializing it (you may or may not be). I would use the clear command for clearing the lcd.
Other advice:
One trick I have tried is just printing a bunch of spaces to the screens. That tends to clear the screen decently, but not always perfectly.
Make sure you’re on the latest version of the pros kernel. There are some related bug fixes in this area.
If I want to clear my controller for debugging during autonomous and reading values during driver control, do I also put the clear controller command in the initialize function? The controller never clears during each period even after the command.
I’m not exactly sure what you’re asking. Initialize is run once when the robot starts, but not after. So the code you posted won’t do anything.
So should I put the clear commands respectively at the start of void autonomous() and void opcontrol() ?
If that’s where you want it to be cleared, yes. Give it a try and see how it works.
So I tried putting the commands at the start of void autonomous and void opcontrol, and I did a few tests on our brain and controller. However, the screens didn’t appear to be cleared in any way. The brain screen appeared black while the controller screen didn’t clear at all.
A couple questions. What version of the pros kernel (not the ci) are you on? You can tell this by running prosv5 c info-project from the command line while in the project. There also may be a way in the pros editor. It should be 3.2.1.
What are you using to clear the lcd screen in the brain? Initialize won’t clear it (and is a no-op when called after the first call iirc).
For the controller, what do you mean by the screen won’t clear? The initial overlay won’t be removed until you write to a couple of lines on the controller. Can you post all the code your using?
So are you saying to add a clear function before initializing and adding a print function after initializing?
Like:
void initialize() {
pros::lcd::clear();
pros::lcd::initialize();
pros::delay(100);
pros::lcd::print(0, "Power: %d", robotSpeed);
}
void opcontrol() {
controller.clear();
pros::delay(50);
controller.set_text(0, 0, "");
while(1) {
// user control code
}
}