Writing a simple code to turn the robot to right. Setup the driver train with inertial sensor. The robot keeps spinning endlessly. Saw in the forum some folks faced this issue in the past. Tried all suggestions - 1) switched the ports for the drive train 2) deep calibration. Our team ha done this successfully in the past but now cannot get this to work. Attaching the block code for reference. Also tried this on 2 different brain but same result . Since this not working on 2 different brains curious if it’s some.recent firmware issue
One note is that when I remove the inertial sensor and do a turn right 90 degrees it does turn right but more than 90 degrees ( in this case it stops). S
Your team gets an award for build, that is a very, very nice drive base!! Lots of great build techniques happening there. I’ve never seen a standoff connector used as a spacer on an axle, adding that to my bag of techniques.
What I was looking for is the code setup for the drivetrain. It may be a red herring, but just wanted to see it to make sure.
The drivetrain works perfectly when we use controller. The drive train spins without stopping in the opp direction. I tried switching the ports but same behavior. When you say drivertrain incorrectly configured, any recommendations how I could resolve?
We just obtained a handful of Gen 2 brains and are experiencing this exact same issue. The rotation direction is not an issue, but the fact that without a “set drive timeout X seconds”, the device will just rotate “forever”. With a timeout value, the rotation continues for “X” seconds and ends at a “random” direction.
It acts like the internal gyro never senses that the unit is turning. The equivalent of a “turn right” block command (which will turn until timeout happens).
As noted by coach2012, selecting “no gyro” and things work well.
We’re using the web based code generator and using blocks not python code just to test and get simple things working.
The code block is trivial.
================
float myVariable;
// "when started" hat block
int whenStarted1() {
Drivetrain.setTimeout(3.6, seconds);
Drivetrain.driveFor(forward, 200.0, mm, true);
Drivetrain.turnFor(right, 90.0, degrees, true);
Drivetrain.stop();
return 0;
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
whenStarted1();
}
Our frustrated fallback is to have the students use Gen1 brains.
Couple of observations from our experience ( we faced this twice) 1) drive train used a gear ratio but did not use the idle gear 2) direction of the drive train which can be fixed in the settings
Thank you for your response.
This is a simple Blocks program that sets the default drive timeout to 3.6 (a number I pulled out of a hat) seconds, does a drive forward for 200 mm (wait to complete), turn 90 degrees (wait to complete) and then stop. When executed, the bot drives 200mm and then initiates a turn in the expected direction for 3.6 seconds. It does NOT stop at 90 degrees of rotation.
Disabling all gyros from the brain in the config allows this to work as wished, though certainly not as accurate as one hopes would happen with a gyro measuring the turn.
Device is configured as 2nd Gen, 2 motor drive in ports 1 and 7. Each motor connected to a single idler gear driving both front and back wheels on each side.
I have configured the drive train in both the forward and reverse settings with no change to the 3.6 second rotation (not stopping at 90) issue. And yes, it does change the direction of the drive and the direction of the turn as expected.
P.S. When running the program as listed, the device dash shows that the brain has rotated 320+ degrees and is currently pointing in a 39+ degree heading. So, it’s recognizing that it has turned.
If your motor is connected to the middle gear then likely that’s the issue. You need to add add 1 idle gear on each side of the motor so the motor and the wheel turn in the same direction
Correction - I misspoke. Each motor is connected to the “front” wheel. The idler gears are there in order to drive the rear wheels. We built these 18 months ago and I didn’t really pay attention when I wrote that the motors were connected to the idler gear.
The direction (forward/backward/left/right) is not the issue. The issue is the lack of control of a turn when using the inertial gyro. And yes, the cables are connected to 1 and 7.
Our symptoms exactly match the description of the initial question at the top of this thread with the exception that we have not successfully gotten this to work.
I just tried a test with an external Gen1 gyro with similar results. It appears that the only way I can get this simplistic 2 move program working is with no gyros enabled?