You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In new_age distro IMU sensors were moved from input-device interface to iio linux subsystem, therefore way of communication and event files locations were changed.
How now information from gyro and accel could be accessed?
By default everything related to iio is kept by path /sys/bus/iio/devices/iio\:device<N>. On TRIK board, device 0 is accelerometer, device 1 is gyro.
There are two ways to obtain sensor value:
Way 1 (default)
Read file responsible for every channel. For example, to read accel x-axis someone could use:
For our case, that is not the best way to collect all channels data from separate files manually and assign with proper timestamps, so the next method is more relevant.
Way 2 (buffers)
iio provides "buffer" support, which puts all chosen channels and corresponding timestamps to the buffer and then could be read and unpacked.
For that, someone should turn on buffer support and specify channels to put into the buffer
Code below enables buffer support and specify what channels will be available in the buffer. Code below enables buffer support and stores all accel values in the buffer.
External libraries
Because iio encapsulates common and well-defined logic for every sensor type, maybe it is better to use already existing libs to read data from sensors instead of doing this manually. There are two common of them: libiio looks like the well-developed one.
This issue is about providing IMU data in runtime taking into account the new logic of interaction with IMU
The text was updated successfully, but these errors were encountered:
In new_age distro IMU sensors were moved from input-device interface to iio linux subsystem, therefore way of communication and event files locations were changed.
How now information from gyro and accel could be accessed?
By default everything related to iio is kept by path
/sys/bus/iio/devices/iio\:device<N>
. On TRIK board, device0
is accelerometer, device1
is gyro.There are two ways to obtain sensor value:
Way 1 (default)
Read file responsible for every channel. For example, to read accel x-axis someone could use:
The same is for other sensor channels.
For our case, that is not the best way to collect all channels data from separate files manually and assign with proper timestamps, so the next method is more relevant.
Way 2 (buffers)
iio provides "buffer" support, which puts all chosen channels and corresponding timestamps to the buffer and then could be read and unpacked.
For that, someone should turn on buffer support and specify channels to put into the buffer
Code below enables buffer support and specify what channels will be available in the buffer. Code below enables buffer support and stores all accel values in the buffer.
In order to properly unpack data, check corresponding flags of every channel -- its position in buffer and way of storage (https://www.kernel.org/doc/html/v4.14/driver-api/iio/index.html).
External libraries
Because iio encapsulates common and well-defined logic for every sensor type, maybe it is better to use already existing libs to read data from sensors instead of doing this manually. There are two common of them:
libiio
looks like the well-developed one.This issue is about providing IMU data in runtime taking into account the new logic of interaction with IMU
The text was updated successfully, but these errors were encountered: