Skip to content

Commit

Permalink
pybricks.common.Accelerometer: Use mm/s/s units.
Browse files Browse the repository at this point in the history
Fixes #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.
  • Loading branch information
laurensvalk committed Apr 1, 2022
1 parent 813ea61 commit 5567289
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 4 additions & 0 deletions doc/main/hubs/movehub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions doc/main/signaltypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions src/pybricks/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def acceleration(self):
"""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
Expand Down Expand Up @@ -807,7 +807,7 @@ def acceleration(self, axis=None):
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.
"""
Expand Down

0 comments on commit 5567289

Please sign in to comment.