Robot spinning endlessly

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

2 Likes

Can you show us the drive base setup please?

Here is the picture of the drive base

1 Like

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.

4 Likes

Got it and thanks for the feedback. Attached the screenshot shot of the configs for drive train



Is it spinning the correct direction, if not, then drivetrain is incorrectly configured.

It’s not a firmware issue.

3 Likes

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?

Can some one explain that a little bit more in depth? Our team was having the same problem so I wanted to get some help with that.

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.

Have you verified that the internal inertial sensor is working using the devices screen ?

3 Likes

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

Thanks for the reply.
Yes, we have:

  • DELETED ALL programs
  • DEEP calibration of the inertial sensor
  • Watched the dashboard change as we manually rotated the brain in various directions.
  • Flipped drive train direction (doesn’t affect the refusal to stop the turn until the timeout just direction)
  • We ARE using the idler gear and all of the gears are 200mm so 1:1 (2 motor drivetrain)
    These are all brand new Gen 2 brains.
1 Like

ok, have a read of this.

perhaps post picture of the robot and also send feedback so we can have a look at the program/drivetrain configuration.

3 Likes

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.

so I have to ask, by expected direction you mean turning clockwise (ie. to the right) ?

and the left motor is connected to port 1 ? (I can’t see the brain in the photo)

with a non-direct drive robot, I would have expected the selected direction/arrow under drivetrain settings to be the lower one not the top.

1 Like

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

Alternatively you consider using a chain to connect the wheels (instead of chaining using gears)

It should work if everything is configured correctly.

2 Likes

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?