I am coding A PID system. this is meaning that I have to code all the motors separately. I cannot use the drive train. To code PID i despretaly need to use the brain internal since I do not own a seperate gyro, it also takes up an extra port which my team cannot afford. When I use the “Calibrate gyro” block it does not calibrate it. I checked to see if it did not show up on the screen for some odd reason, but rest assured that is not the case, when printing the rotation separately it shows nothing. When I run the code, it pretends like there is no value of brain rotation. How do I fix this issue, calibrating the brain without a drive train. I’m fine using switch blocks or completely going to Python or C++.
After calling calibrate you should wait for calibration to complete, any text on the screen needs to be generated by your code, VEXcode does this automatically when you use an inertial sensor with the drivetrain, for example, this code is generated and visible when working with C++ in VEXcode, Python would be similar.
bool vexcode_initial_drivetrain_calibration_completed = false;
void calibrateDrivetrain() {
wait(200, msec);
Brain.Screen.print("Calibrating");
Brain.Screen.newLine();
Brain.Screen.print("Inertial");
BrainInertial.calibrate();
while (BrainInertial.isCalibrating()) {
wait(25, msec);
}
vexcode_initial_drivetrain_calibration_completed = true;
// Clears the screen and returns the cursor to row 1, column 1.
Brain.Screen.clearScreen();
Brain.Screen.setCursor(1, 1);
}
Ok so if I do want the text, I have to put it in there myself. But should this C++ code work for calibration? Do you think this is translatable to blocks? I can code in C++, but it’s been almost half a year since I have done anything in it.
Ok, so I was slightly misleading, perhaps I mis-understood your question.
In blocks, the calibrate block will wait for completion, but does not print anything on the screen while it calibrates as when using a drivetrain.
To test the inertial is woking and/or allow debug, you could have some code like this.
Thanks, I got it fixed. I misunderstood the function, and I think I confused you. I was mainly trying to figure out this weird thing, and the C++ example really helped.