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

sensor_shell: strange and unexpected output when getting single axis from 3-axis data #72840

Open
ycsin opened this issue May 16, 2024 · 1 comment · May be fixed by #72841
Open

sensor_shell: strange and unexpected output when getting single axis from 3-axis data #72840

ycsin opened this issue May 16, 2024 · 1 comment · May be fixed by #72841
Assignees
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@ycsin
Copy link
Collaborator

ycsin commented May 16, 2024

Describe the bug
Getting the data of a single axis from 3-axis data is kinda weird, the following output is from #72833:

uart:~$ sensor get sensor@0 0
channel type=3(accel_xyz) index=0 shift=0 num_samples=0 value=4294967295ns, (-0.000000, -0.000000, -0.000000)
uart:~$ sensor get sensor@0 1
uart:~$ sensor get sensor@0 2
uart:~$ sensor get sensor@0 3
channel type=3(accel_xyz) index=0 shift=2 num_samples=1 value=9220133425350000000ns, (3.000000, 3.000000, 3.000000)
uart:~$ sensor get sensor@0 4
channel type=7(gyro_xyz) index=0 shift=0 num_samples=0 value=4294967295ns, (-0.000000, -0.000000, -0.000000)
uart:~$ sensor get sensor@0 5
uart:~$ sensor get sensor@0 6
uart:~$ sensor get sensor@0 7
channel type=7(gyro_xyz) index=0 shift=3 num_samples=1 value=9220133425350000000ns, (7.000000, 7.000000, 7.000000)

i.e., there's no output for channel(s):

  • 1 (acc - y)
  • 2 (acc - z)
  • 5 (gyro - y)
  • 6 (gyro - z)
  • ...

To Reproduce
Steps to reproduce the behavior:

  1. Build the sensor_shell sensor with board that has a acc/mag/gyro, or check-out samples: sensor_shell: add fake sensor driver & pytest #72833
  2. Use sensor get for the y-axis

What you will see

  • Getting x-axis (i.e. accel_x) will be redirected to xyz (accel_xyz) and the output is wrong
  • No output when getting y-axis & z-axis
  • The above is consistent for at least the accel, mag & gyro channels

Expected behavior
Use should be able to get any supported channel from the sensor, there should be output when getting a single axis (x, y or z)

Impact
sensor get is not able to sample some of the channel(s).

Logs and console output
See above

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: 0.16.5-1
  • Upstream main
@ycsin ycsin added bug The issue is a bug, or the PR is fixing a bug area: Sensors Sensors labels May 16, 2024
@teburd
Copy link
Collaborator

teburd commented May 16, 2024

@yperess please take a look when you can

@nashif nashif added the priority: medium Medium impact/importance bug label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants