Skip to content

change from dps->rads for gyro to fix #9 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Usage Example

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sox.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sox.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s"%(sox.gyro))
print("")
time.sleep(0.5)

Expand Down
8 changes: 3 additions & 5 deletions adafruit_lsm6ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM6DSOX.git"
from time import sleep
from math import radians
from micropython import const
import adafruit_bus_device.i2c_device as i2c_device
from adafruit_register.i2c_struct import ROUnaryStruct, Struct
Expand Down Expand Up @@ -293,12 +294,9 @@ def acceleration(self):

@property
def gyro(self):
"""The x, y, z angular velocity values returned in a 3-tuple and are in degrees / second"""
"""The x, y, z angular velocity values returned in a 3-tuple and are in radians / second"""
raw_gyro_data = self._raw_gyro_data
x = self._scale_gyro_data(raw_gyro_data[0])
y = self._scale_gyro_data(raw_gyro_data[1])
z = self._scale_gyro_data(raw_gyro_data[2])

x, y, z = [radians(self._scale_gyro_data(i)) for i in raw_gyro_data]
return (x, y, z)

def _scale_xl_data(self, raw_measurement):
Expand Down
2 changes: 1 addition & 1 deletion examples/lsm6ds_full_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

while True:
print(
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"
"Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f radians/s"
% (sensor.acceleration + sensor.gyro)
)
time.sleep(0.05)
2 changes: 1 addition & 1 deletion examples/lsm6ds_ism330dhct_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
2 changes: 1 addition & 1 deletion examples/lsm6ds_lsm6ds33_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
2 changes: 1 addition & 1 deletion examples/lsm6ds_lsm6dsox_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
print("")
time.sleep(0.5)
118 changes: 0 additions & 118 deletions register_map.json

This file was deleted.