We’ve been working with the inertial sensor for a while for our autonomous routines, but after the update to the 1.1.1 version we’ve been having an issue in three different robots programmed by different people where out of nowhere the inertial sensor stops at a certain angle regardless of the instruction. We’ve tried printing the angle at which it stops and even if we tell it to stop at 170 degrees it stops at 132 and continues with the next line of code. This changes with every robot, with some stopping at 90 degrees, for example, even if we’re telling it to stop at totally different angle. We’re not sure if it’s something related to the update, but it just started to happen after we updated the brains, so we’re wondering if anyone else has had this issue.
There were no changes to the inertial sensor code in vexos 1.1.1 (as compared to 1.1.0), what version did you have before the update ?
There were some changes to the drivetrain classes in the recent VEXcode releases, but they have been out since early March.
do you have some simple example code that demonstrates the issue ?
void autonomous(void) {
smartDrive.setStopping(brake);
going(1, 46.0, 100);
frontValve.set(1);
goingTimeout(2, 30.0, 100, 4);
moguitoTimeout(2, 470.0, 50, 3.0);
rotating(-170.0, 3);
Controller.Screen.print(inertialSensor.yaw());
goingTimeout(1, 36.0, 20, 6.5);
}
This is part of our autonomous routine. It was doing the routine properly, but out of nowhere it started stopping at a certain angle regardless of the one we asked. We decided to print the angle at which it stop trying to see if maybe it wasn’t calibrated and at the angle it stopped was the angle the sensor thought was the right one. But after printing the angle we got that it stopped at -132 degrees instead of the -170 we were asking for. Even if we tell it to rotate to -200 it would keep stopping at -132 and continue with the next line of code.
void rotating(double howMuch, int howFast){
smartDrive.setTurnVelocity(howFast, percent);
smartDrive.turnToRotation(howMuch, degrees);
}
This is the code included in our rotating function.
We were using version 1.1.0 before this.
Any chance you’re hitting a timeout?
That function does have a timeout.
So if your code is exiting due to timeout, rather than motion complete, changing the angle wouldn’t matter. If your mechanism changed, bot got heavier, or some other factors, your issue isn’t version related. You could double check by making timeout really long
Doesn’t* sorry. We’re not using a timeout for our rotating function. The robot is supposed to continue with the next function only after rotating to its -170 angle and it stops at -132
If you’ve ever set a timeout for an axis, I believe that it is registered forever. Think about the troubleshooting you’ve done
- Set a move
- Seen an incorrect move
- Changed the move distance
- Seen no change
You believe that it is a code update that caused your problem, but you could also try to make changes shorter than your observed moves and see if that impacts the motion. Try to rule things out. This is good debug practice.
Not really enough code to go on.
The smartdrive and drivetrain classes are pretty independent of vexos, they call motors functions and monitor the inertial sensor. So perhaps an update to VEXcode changed your program behavior, but it seems unlikely an update to vexos would do this.
Do you have any other tasks running that may try and control drivetrain motors ? One change we made in the February SDK for VEXcode was to allow driveFor and turnTo functions to be interrupted if other motor commands were sent to the motors, for example, of a bumper switch was pressed and stop sent.
No, in this case we’re not using any other sensors just the inertial. But today we noticed that if we separate the function in two it finishes in the desire angle flawlessly.
We used to have this and it would stop at -132 based on what it printed on the screen
rotating(-170, 3);
But we tried dividing the task in two and it finished at the desired 170
rotating(90, 3);
rotating(80, 3);
You are moving really slowly, only 3% ?
Yeah, that’s almost our ideal speed. It makes the turns more precise.