From 6071e4e7d34a5f48012079a23db515ded8162eb8 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 20 Feb 2019 21:11:25 -0600 Subject: [PATCH] parameters: rename Direction.(counter)clockwise to Direction.(C)CW clockwise and counterclockwise are very long to type, so replace them with the common abbriviations --- pybricks/ev3devices.py | 14 +++++++------- pybricks/parameters.py | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pybricks/ev3devices.py b/pybricks/ev3devices.py index 171d131..5fb136b 100644 --- a/pybricks/ev3devices.py +++ b/pybricks/ev3devices.py @@ -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 diff --git a/pybricks/parameters.py b/pybricks/parameters.py index aba3082..a5504a0 100644 --- a/pybricks/parameters.py +++ b/pybricks/parameters.py @@ -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):