Answers.Body: <p>This formula will need the lateral distance between wheels, i.e. the distance between left and right wheel, not the back and front wheel.</p>
  <blockquote>
  <p>motor_pair.move(8.1 * math.pi / 2, 'cm', steering=100)</p>
  </blockquote>
  <p>The <code>steering=100</code> parameter means that the wheels will move in opposite directions. For the <strong>8.1</strong> value, one wheel will move <strong>+12.7cm</strong> and the other wheel will move <strong>-12.7cm</strong>. That is half of the circumference of a circle with diameter of <strong>8.1 cm</strong>.</p>
  <p>Now to the question: exactly what point of the wheel you should measure in left-right direction. It should be the point of the wheel that does not slip when turning - the outer edge will slip one way and the inner edge will slip the other way.</p>
  <p>Measuring between the middle of the wheels will be a good first approximation. However the exact value will depend on the tire texture and their mounting alignment. You can test how exactly it turns 180 degrees and fine tune the value to larger or smaller.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-13T16:44:35.187Z
Answers.LastActivityDate: 2021-01-13T16:44:35.187Z
Answers.UserDisplayName: jpa
Body: <p>I am trying to make a program that requires my 51515 to turn a specified number of degrees. I found a way to do that on the LEGO app's &quot;Knowledge Base&quot;, but the given example was:</p>
  <pre><code>import math
  from mindstorms import MotorPair
  
  motor_pair = MotorPair('B', 'A')
  
  # Turn a Driving Base 180 degrees in place (if wheels are 8.1 cm apart).
  motor_pair.move(8.1 * math.pi / 2, 'cm', steering=100)
  </code></pre>
  <p>My issue is that I do not know exactly how to measure the distance between the wheels. Am I supposed to measure from the middles of the wheels? The outsides? the insides?</p>
  
Tags: <programming><robotic><wheel><spike-prime>
Title: When using pi * distance between wheels/tracks, how do I measure distance between wheels?
UserDisplayName: technicguy1
ThreadText: # When using pi * distance between wheels/tracks, how do I measure distance between wheels?
  
  (Asked by: username_0 on 2021-01-13)
  
  I am trying to make a program that requires my 51515 to turn a specified number of degrees. I found a way to do that on the LEGO app's "Knowledge Base", but the given example was:
  import math
  from mindstorms import MotorPair
  
  motor_pair = MotorPair('B', 'A')
  
  # Turn a Driving Base 180 degrees in place (if wheels are 8.1 cm apart).
  motor_pair.move(8.1 * math.pi / 2, 'cm', steering=100)
  
  My issue is that I do not know exactly how to measure the distance between the wheels. Am I supposed to measure from the middles of the wheels? The outsides? the insides?
  
  **Tags:** programming, robotic, wheel, spike-prime
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-13. Score: 4 | Accepted answer
  
  This formula will need the lateral distance between wheels, i.e. the distance between left and right wheel, not the back and front wheel.
  
  > motor\_pair.move(8.1 \* math.pi / 2, 'cm', steering=100)
  
  The `steering=100` parameter means that the wheels will move in opposite directions. For the **8.1** value, one wheel will move **+12.7cm** and the other wheel will move **-12.7cm**. That is half of the circumference of a circle with diameter of **8.1 cm**.
  
  Now to the question: exactly what point of the wheel you should measure in left-right direction. It should be the point of the wheel that does not slip when turning - the outer edge will slip one way and the inner edge will slip the other way.
  
  Measuring between the middle of the wheels will be a good first approximation. However the exact value will depend on the tire texture and their mounting alignment. You can test how exactly it turns 180 degrees and fine tune the value to larger or smaller.
  
  
  ---
  
  