Skip to content
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

Fix imu report (linear acceleration and angular velocity) #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
18 changes: 9 additions & 9 deletions ds4drv/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DS4Report(object):
"button_options",
"button_trackpad",
"button_ps",
"motion_y",
"motion_x",
"motion_z",
"orientation_roll",
"orientation_yaw",
"orientation_pitch",
"ang_vel_x",
"ang_vel_y",
"ang_vel_z",
"lin_acc_x",
"lin_acc_y",
"lin_acc_z",
"trackpad_touch0_id",
"trackpad_touch0_active",
"trackpad_touch0_x",
Expand Down Expand Up @@ -181,13 +181,13 @@ def parse_report(self, buf):
# Trackpad and PS buttons
(buf[7] & 2) != 0, (buf[7] & 1) != 0,

# Acceleration
# Angular velocity
S16LE.unpack_from(buf, 13)[0],
S16LE.unpack_from(buf, 15)[0],
S16LE.unpack_from(buf, 17)[0],

# Orientation
-(S16LE.unpack_from(buf, 19)[0]),
# Linear acceleration
S16LE.unpack_from(buf, 19)[0],
S16LE.unpack_from(buf, 21)[0],
S16LE.unpack_from(buf, 23)[0],

Expand Down
12 changes: 6 additions & 6 deletions ds4drv/uinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def create_mapping(name, description, bustype=0, vendor=0, product=0,
"ABS_RZ": "right_analog_y",
"ABS_RX": "l2_analog",
"ABS_RY": "r2_analog",
"ABS_THROTTLE": "orientation_roll",
"ABS_RUDDER": "orientation_pitch",
"ABS_WHEEL": "orientation_yaw",
"ABS_DISTANCE": "motion_z",
"ABS_TILT_X": "motion_x",
"ABS_TILT_Y": "motion_y",
"ABS_THROTTLE": "ang_vel_x",
"ABS_RUDDER": "ang_vel_y",
"ABS_WHEEL": "ang_vel_z",
"ABS_DISTANCE": "lin_acc_z",
"ABS_TILT_X": "lin_acc_x",
"ABS_TILT_Y": "lin_acc_y",
},
# Axes options
{
Expand Down