From 556728937f7593f1919680267aa0c706ba0c89b6 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 1 Apr 2022 15:41:15 +0200 Subject: [PATCH] pybricks.common.Accelerometer: Use mm/s/s units. Fixes https://github.com/pybricks/pybricks-api/issues/94 For Move Hub, this is a breaking change since Move Hub IMU support was already released. For the other hubs, the IMU API has not been released yet, so we can do this silently. --- doc/main/hubs/movehub.rst | 4 ++++ doc/main/signaltypes.rst | 11 +---------- src/pybricks/_common.py | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/doc/main/hubs/movehub.rst b/doc/main/hubs/movehub.rst index 8b9c1d9..070afe7 100644 --- a/doc/main/hubs/movehub.rst +++ b/doc/main/hubs/movehub.rst @@ -27,6 +27,10 @@ Move Hub .. automethod:: pybricks.hubs::MoveHub.imu.acceleration + .. versionchanged:: 3.2 + + Changed acceleration units from m/s/s to mm/s/s. + .. rubric:: Using the battery .. automethod:: pybricks.hubs::MoveHub.battery.voltage diff --git a/doc/main/signaltypes.rst b/doc/main/signaltypes.rst index 05e9dbe..8080765 100644 --- a/doc/main/signaltypes.rst +++ b/doc/main/signaltypes.rst @@ -118,22 +118,13 @@ linear acceleration: mm/s/s -------------------------------- Linear acceleration describes how fast the speed changes. This is expressed as -the change of the millimeters per second, during one second (deg/s/s). +the change of the millimeters per second, during one second (mm/s/s). This is also commonly written as :math:`mm/s^2`. For example, you can adjust the acceleration setting of a :class:`DriveBase <.robotics.DriveBase>` to change how smoothly or how quickly it reaches the constant speed set point. -.. _linacceleration_m: - -linear acceleration: m/s/s --------------------------------- - -As above, but expressed in meters per second squared: :math:`m/s^2`. -This is a more practical unit for large values such as those given by an -accelerometer. - Approximate and relative units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/pybricks/_common.py b/src/pybricks/_common.py index 62643ca..4eacebb 100644 --- a/src/pybricks/_common.py +++ b/src/pybricks/_common.py @@ -761,7 +761,7 @@ class SimpleAccelerometer: """Gets the acceleration of the device. Returns: - tuple of :ref:`linacceleration_m`: Acceleration along all three + tuple of :ref:`linacceleration`: Acceleration along all three axes. """ pass @@ -807,7 +807,7 @@ class Accelerometer(SimpleAccelerometer): axis (Axis): Axis along which the acceleration is measured. Returns: - :ref:`linacceleration_m`: Acceleration along the + :ref:`linacceleration`: Acceleration along the specified axis. If you specify no axis, this returns a vector of accelerations along all axes. """