From e722451af13ae9df9dfa63daa8ee754a2788a23f Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 2 Jul 2019 13:08:20 +0200 Subject: [PATCH] api: add Axis.ALL identifier --- pybricks/_common.py | 10 ++++++---- pybricks/parameters.py | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pybricks/_common.py b/pybricks/_common.py index e9cce54..07b4b97 100644 --- a/pybricks/_common.py +++ b/pybricks/_common.py @@ -628,17 +628,19 @@ class Accelerometer(): """ pass - def acceleration(self, axis=None): - """Measure the acceleration of the device along a given axis in the + def acceleration(self, axis=Axis.ALL): + """acceleration(axis=Axis.ALL) + + Measure the acceleration of the device along a given axis in the :ref:`robot reference frame `. Arguments: axis (Axis): Axis along which the acceleration is - measured. (*Default*: ``None``) + measured. (*Default*: ``axis=Axis.ALL``) Returns: :ref:`linacceleration`. Returns a :ref:`scalar` of the acceleration along the specified axis. - If ``axis`` is ``None``, you get a :ref:`vector` with the + If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the accelerations along all three axes (x, y, z). """ diff --git a/pybricks/parameters.py b/pybricks/parameters.py index 422146e..ec58ea7 100644 --- a/pybricks/parameters.py +++ b/pybricks/parameters.py @@ -192,10 +192,15 @@ class Axis(): .. data:: X .. data:: Y .. data:: Z + + Some methods let you measure along all axes at once: + + .. data:: ALL """ X = (1, 0, 0) Y = (0, 1, 0) Z = (0, 0, 1) + ALL = None class Align():