Answers.Body: <p>Here are some gyro issues you still have to contend with. </p>
  
  <ol>
  <li>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 <em>very</em> slowly.</li>
  <li>Accuracy. They gyro only reads in increments of 1 degree and it's also not terribly accurate (repeatable). </li>
  <li>"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.</li>
  </ol>
  
  <p>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.</p>
  
  <p>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). </p>
  
  <p>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.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>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. </p>
  
  <p>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. </p>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-03T13:45:48.687Z
Answers.LastActivityDate: 2017-03-04T13:23:10.530Z
Answers.LastEditDate: 2017-03-04T13:23:10.530Z
Answers.UserDisplayName: jlar310
Body: <p>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?</p>
  
  <p>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.</p>
  
  <p>Another option would be to only change the motor power on one side for the tank steer. </p>
  
  <p>My plan is to test all three types but I would like to hear comments from those of you with more experience.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-18T19:20:31.663Z
Comments.Text: 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.
Comments.UserDisplayName: dfrevert
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-18T20:44:36.690Z
Comments.Text: 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.
Comments.UserDisplayName: banno
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-18T21:09:58.067Z
Comments.Text: Spin, fast until close then slower with some compensation to handle over rotation. Motor, Steering, or Tank can work. "Close" depends on the robot.
Comments.UserDisplayName: dfrevert
Tags: <ev3><gyro>
Title: Which move block to use with Gyro?
UserDisplayName: banno
ThreadText: # Which move block to use with Gyro?
  
  (Asked by: username_0 on 2015-12-15)
  
  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.
  
  **Tags:** ev3, gyro
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: 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.  
  > **username_1**: Spin, fast until close then slower with some compensation to handle over rotation. Motor, Steering, or Tank can work. "Close" depends on the robot.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-03. Score: 1
  
  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.
  
  **EDIT**
  
  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.
  
  
  ---
  
  