parameters: rename Direction.(counter)clockwise to Direction.(C)CW

clockwise and counterclockwise are very long to type, so replace them with the common abbriviations
This commit is contained in:
David Lechner
2019-02-27 15:23:16 -06:00
parent 2e3d013fec
commit 6071e4e7d3
2 changed files with 18 additions and 18 deletions
+7 -7
View File
@@ -13,12 +13,12 @@ class Motor():
* 45503 or 45502: Separate part (2013)
"""
def __init__(self, port, direction=Direction.clockwise, gears=None):
"""Motor(port, direction=Direction.clockwise, gears=None)
def __init__(self, port, direction=Direction.CW, gears=None):
"""Motor(port, direction=Direction.CW, gears=None)
Arguments:
port (Port): Port to which the motor is connected.
direction (Direction): Positive speed direction (*Default*: Direction.clockwise).
direction (Direction): Positive speed direction (*Default*: Direction.CW).
gears (list): List of gears linked to the motor (*Default*: ``None``).
For example: ``[12, 36]`` represents a gear train with a 12-tooth and a 36-tooth gear. See :ref:`ratio` for illustrated examples.
@@ -39,10 +39,10 @@ class Motor():
example_motor = Motor(Port.A)
# Initialize a motor where positive speed values should go counterclockwise
right_motor = Motor(Port.B, Direction.counterclockwise)
right_motor = Motor(Port.B, Direction.CCW)
# Initialize a motor with a gear train
robot_arm = Motor(Port.C, Direction.clockwise, [12, 36])
robot_arm = Motor(Port.C, Direction.CW, [12, 36])
"""
pass
@@ -406,11 +406,11 @@ class GyroSensor():
"""
def __init__(self, port):
"""GyroSensor(port, direction=Direction.clockwise)
"""GyroSensor(port, direction=Direction.CW)
Arguments:
port (Port): Port to which the sensor is connected.
direction (Direction): Positive rotation direction when looking at the red dot on top of the sensor (*Default*: Direction.clockwise).
direction (Direction): Positive rotation direction when looking at the red dot on top of the sensor (*Default*: Direction.CW).
"""
pass
+11 -11
View File
@@ -96,11 +96,11 @@ class Stop(Enum):
class Direction():
"""Rotational direction for positive speed values: clockwise or counterclockwise.
.. data:: clockwise
.. data:: CW
A positive speed value should make the motor move clockwise.
.. data:: counterclockwise
.. data:: CCW
A positive speed value should make the motor move counterclockwise.
@@ -108,13 +108,13 @@ class Direction():
For NXT or EV3 motors, make sure to look at the motor with the red/orange shaft to the lower right.
+----------------------------+-------------------+-----------------+
| Parameter | Positive speed | Negative speed |
+============================+===================+=================+
| Direction.clockwise | clockwise | counterclockwise|
+----------------------------+-------------------+-----------------+
| Direction.counterclockwise | counterclockwise | clockwise |
+----------------------------+-------------------+-----------------+
+-------------------+-------------------+------------------+
| Parameter | Positive speed | Negative speed |
+===================+===================+==================+
| Direction.CW | clockwise | counterclockwise |
+-------------------+-------------------+------------------+
| Direction.CCW | counterclockwise | clockwise |
+-------------------+-------------------+------------------+
::
@@ -149,8 +149,8 @@ class Direction():
"""
clockwise = 0
counterclockwise = 1
CW = 0
CCW = 1
class Button(Enum):