We would like to make a series Gyro drive blocks. As a general rule what would be the benefits and drawbacks from using the move tank and move steer blocks?

My basic design is to read the gyro and compute the error from the desired direction the multiply the error by a gain. This gain would be the direction for the move steer block. For the move tank we subtract the error from one motor and add the error to the other motor.

Another option would be to only change the motor power on one side for the tank steer.

My plan is to test all three types but I would like to hear comments from those of you with more experience.

  • Not the Move Steering Block's steering parameter because it changes the center of the robot rotation. You probably want the robot to spin from the center of the robot so you're isolating the direction the robot is headed from the location of the robot. Not the Tank Move block power settings because the robot will stall at power levels near zero, so the robot will not want to reach the desired direction. The Gyro works, but using it is not always obvious. First you'll need to solve the reset and drift issues.
    – dfrevert
    Dec 18 '15 at 19:20
  • Thanks for the comment. Reset and drift are under control. Based on what you are saying not to do takes away my above options. Which way would you recommend? For tank move pass in a base power level typically 40% then add the error to one motor and subtract the error from the other.
    – banno
    Dec 18 '15 at 20:44
  • Spin, fast until close then slower with some compensation to handle over rotation. Motor, Steering, or Tank can work. "Close" depends on the robot.
    – dfrevert
    Dec 18 '15 at 21:09

Here are some gyro issues you still have to contend with.

  1. Lag. The gyro reading lags behind the actual movement. If, for example, you are spinning and waiting for a reading of 90 degrees before stopping the movement, you will be beyond 90 degrees after you stop, unless you are moving very slowly.
  2. Accuracy. They gyro only reads in increments of 1 degree and it's also not terribly accurate (repeatable).
  3. "Offset". As your gyro algorithm does it's processing, the steering correction will restore the heading, but you may no longer be on the same linear path. Let's say your robot has a left bias. As it turns off course to the left and the gyro algorithm corrects back to the right, you may be back on the correct heading, but your path is now slightly to the left of where you started. You will zig-zag like this all the way there.

If you can deal with those issues, your algorithm idea is solid. But you may find that Move Steer and Move Tank are more accurate. It really depends on the situation.

I have written blocks that use the gyro to set the heading for movement, but not for in-place turns. In-place turns are made very difficult by the lag issue unless you are willing to do all your turns at the same speed and use a simple offset value to compensate (i.e., stop motors at 86 degrees, usually comes to rest at 90).

With my "Move Gyro" block, I don't even need to execute an explicit turn motion, I can say "move 10 inches at heading of 0 degrees, then 10 inches at heading 90 degrees, the gyro algorithm makes the turn automatically (and rather quickly) as it moves forward. It will be close, but the result will not be exactly 10 inches in both directions.


After re-reading your question, I may be a little off the mark, or just not clear on what you are asking. Your use of Move-Steer or Move-Tank depends on what you are trying to do.

To turn without driving forward, you could use either Move-Tank or Move-Steer until you reach your desired gyro angle. Move-Tank should pivot mostly in-place around the midpoint between the drive wheels. A Move-Steer turn without driving forward would require maximum turning input which should keep one wheel un-powered. This is called a pivot turn and is probably better executed by operating the 2 motors independently. Turn one motor off and apply the brake, then power the other motor until your desired turn is made. You can probably do this just as accurately without the gyro. In a pivot turn, one wheel moves along an arc. The length of this arc for a given turn angle can be calculated based on the distance between your drive wheels (wheel track) and the circumference of your wheels. Thus, lock one motor, drive the other motor the necessary distance to travel along the arc. If you aren't into geometry, post a new question for the math on that.

To drive forward along a gyro heading, your algorithm idea is a good one, except for my point in item 3 above. But if your robot tracks well, that offset should be minor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.