Using Two Gyro Sensors to Turn

Hi, my team’s robot is inconsistent in turning whenever we execute programs. I was wondering if using 2 gyro sensors to turn would make turning more precise. Or is there a better way alternative ? If using 2 gyro sensors is the best option we have, how do we write a program that uses 2 gyro sensors to turn? We use a standard vex iq gyro sensor and we use whenever we program.

You don’t need 2 gyro sensors to turn precisely. You do need to calibrate the gyro (keeping the robot perfectly still) before you start driving. By default it calibrates for 2 seconds, but longer is better. The other problem a lot of teams have is that they turn too fast and over-shoot the target. Slow down the turning velocity and turns will get more accurate. Finally, the type of wheels you are using can make a difference depending on how your drivetrain is configured.

Using two gyro sensors wouldn’t help your accuracy. The Gyro sensors in IQ are not usually the best and more accurate things to use.

Thank you Sarge! We already do calibrate the gyro sensor every time we run the program though and it still isn’t as precise as we want it to be. As for turning slower we could do that but it would waste time since we only have 1 minute and we are already at 57 seconds. Although we do have another issue. Whenever we program the robot to drive straight it goes the correct distance but ends up turning to the left about 12 degrees even though that turn isn’t in the code. Any thoughts on that.

If you want to describe your drivetrain and maybe post a screenshot of your code, I’m happy to take a look. We use the gyro and find it to be exceptionally accurate, especially if we calibrate for the full 8 seconds before the start of the match. However, we did have to write some code to decelerate the turns so as not to over-shoot the desired heading.

Oh - I see from your other thread that you are using RobotC, which I don’t have any experience in. Our students are still using blocks…

If you can code something similar to this, it would help you understand if the problem is gyro accuracy or (more likely) overshooting the turn.

This will do a series of four 90-degree turns, starting at full speed, then 75%, 50%, and 25%. The 25% turn should have the smallest error. Try a turn at, say 10% speed and it should be very accurate.

We have a routine that calculates the size of the turn, and starts it fast but progressively slows it down the closer it gets to the target heading so we don’t over-shoot. It is incredibly accurate. Here is an example of the logic if you are interested in trying something similar:

Thank Sarge! We actually use robotc graphical which is a drag and drop block version of regular robotc.

This is a sample of our program where we make it pick up one green cube, turn and place it. It sometimes overshoots the turn but the main issue is the robot goes the .7 rotations and does a sudden turn that’s not in the code like the one I mentioned earlier.

Here’s a description of our chain drive.

OK, so looks like this is a tank drive system, and your bot must drive pretty quick! Are you using rubber wheels or omni wheels?

Also, have you turned “holding” off on the drive motors?

As @Sarge mentioned, you want to set your brake mode to brake stop instead of brake hold. What’s happening is due to the slack on your chain, the different amount of slack between the right and left side chains. Brake hold will lock the motors and any slack will cause the robot to turn or move back.

I haven’t seen a set brake mode command in RobotC graphical. But in RobotC text, it’s simply

setMotorBrakeMode(LeftDrive, motorBrake);
setMotorBrakeMode(RightDrive, motorBrake);

However, when you are using something like a moveMotor motor command to a specific number of degrees or rotations, once the motor has reached that distance it will apply motorHold. So, you must immediately after that command put in setMotor(LeftDrive, 0) so it puts in the stop command, which will allow the motorBrake to take affect.

1 Like

Thanks! I will try that.

1 Like

I’m using 2 Omni in the front and 2 rubber in her back.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.